package kaizen;

// Decompiled by DJ v3.9.9.91 Copyright 2005 Atanas Neshkov  Date: 07/02/2013 05:26:52 p.m.
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   EngineAc.java

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Properties;
import java.util.Vector;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import kaizen.jdbc.DbAppUnivC;
import kaizen.jdbc.dbRecord;
import kaizen.nomweb.*;

public class EngineAc extends HttpServlet
{

    public EngineAc()
    {
        props = null;
        dir_pagInicio = null;
        url_ConectAc = "";
        url_clases = "";
    }

    private boolean cambioNK(Vector vector, HttpServletRequest httpservletrequest)
        throws IOException
    {
        for(int i = 0; i < vector.size(); i++)
        {
            String as[] = (String[])vector.elementAt(i);
            String s = as[utilerias.DIC_BD_TIPOLLAVE];
            String s1 = as[utilerias.DIC_BD_CAMPO];
            if(s != null)
                s = s.trim();
            if(s.startsWith("nk"))
            {
                String s2 = utilerias.tomaParametro(s1.trim(), httpservletrequest);
                String s3 = utilerias.tomaParametro("nk_" + s1.trim(), httpservletrequest);
                if(s2 != null && s3 != null && !s2.trim().equals(s3.trim()))
                    return true;
            }
        }

        return false;
    }

    private String detalleReporte(String s, String s1, HttpServletRequest httpservletrequest, String s2)
        throws IOException
    {
        String s3 = "";
        Vector vector = new Vector();
        Vector vector1 = new Vector();
        String s4 = "";
        String s5 = url_ConectAc;
        String s6 = "";
        String s7 = "";
        String s8 = "";
        boolean flag = false;
        int i = 0;
        if(FunInsertEng.fncNum("rp_count", httpservletrequest).length() == 0)
            i = Integer.valueOf(utilerias.tomaParametro("rp_count", httpservletrequest)).intValue();
        Vector vector2 = utilerias.obtieneDiccionario(s, s1, false, httpservletrequest);
        String s9 = utilerias.tomaParametro("avance", httpservletrequest);
        if(vector2.size() == 0)
            return utilerias.generaMsg("No existen registros en la tabla: " + s, httpservletrequest);
        Vector vector3 = FuncEng.obtieneRegRep(vector2, true);
        s7 = s7 + templates.generaHidden("dic_tabla", s);
        s7 = s7 + templates.generaHidden("dic_estado", "82");
        s7 = s7 + templates.generaHidden("dic_tabla", s);
        s7 = s7 + templates.generaHidden("rp_count", "0");
        Vector vector4 = new Vector();
        Vector vector5 = new Vector();
        String s10 = "";
        for(int j = 0; j < vector3.size(); j++)
        {
            String as[] = (String[])vector3.elementAt(j);
            vector4.addElement(as[2]);
            if(j == 0)
                s10 = as[2];
        }

        flag = true;
        String s11 = FuncEng.obtieneValoresReqDetalleTabla(vector2, httpservletrequest);
        String s12 = generaSelectDetalle(vector2, s, httpservletrequest, s1, s11);
        if(FunInsertEng.fncNum("orden", httpservletrequest).length() > 0 && utilerias.tomaParametro("orden", httpservletrequest) != null)
            s12 = s12 + " ORDER BY " + s.trim() + "." + utilerias.tomaParametro("orden", httpservletrequest).trim();
        else
            s12 = s12 + " ORDER BY " + s.trim() + "." + s10;
        s12 = FuncEng.validaSQLCombo(s12, httpservletrequest);
        Vector vector6 = DbAppUnivC.execQuery(s12);
        if(vector6.size() == 0)
            return "";
        int k = Integer.valueOf(props.getProperty("rep_max_detalle")).intValue();
        if(s9 == null)
        {
            for(int l = 0; l < vector6.size(); l++)
            {
                dbRecord dbrecord = (dbRecord)vector6.elementAt(l);
                if(FuncEng.coincideRegistro(vector2, httpservletrequest, dbrecord, vector4.size()))
                {
                    int k1 = i + k;
                    if(l + 1 > k1)
                    {
                        for(; k1 + k < l + 1; k1 += k);
                        i = k1;
                    }
                    l = vector6.size();
                }
            }

        }
        int i1 = i + k;
        if(i1 > vector6.size())
            i1 = vector6.size();
        for(int j1 = i; j1 < i1; j1++)
        {
            dbRecord dbrecord1 = (dbRecord)vector6.elementAt(j1);
            String s13 = "";
            for(int l1 = 1; l1 <= vector2.size(); l1++)
            {
                String as1[] = (String[])vector2.elementAt(l1 - 1);
                if(as1[3].length() > 0)
                {
                    String s17 = dbrecord1.getField(l1 + vector4.size());
                    if(s17 == null)
                        s17 = "";
                    else
                        s17 = s17.trim();
                    s13 = templates.generaRef(s13, as1[2], s17);
                }
            }

            s13 = templates.generaRef(s13, "dic_tabla", s);
            vector5.addElement(s13);
        }

        s6 = "Total de Registros : " + String.valueOf(vector6.size());
        boolean flag1 = false;
        if(s2.indexOf("M") >= 0)
            flag1 = true;
        String s14 = utilerias.tomaParametro("orden", httpservletrequest);
        if(s14 == null)
            s14 = s10;
        else
            s14 = utilerias.tomaParametro("orden", httpservletrequest).trim();
        String s15 = generaHiddensRepDetalle(vector2, httpservletrequest);
        String s16 = generaTablaReporteEspecial(vector4, vector6, vector5, vector4.size(), flag1, i, s, s14, k, vector2, vector6, httpservletrequest, "3", s15);
        s3 = s16;
        return s3;
    }

    public void doGet(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
        throws ServletException, IOException
    {
        HttpServletRequest httpservletrequest1 = httpservletrequest;
        if(httpservletrequest.getParameter("pos") != null && httpservletrequest.getParameter("pos") != "")
            httpservletrequest = utilerias.getRequest(httpservletrequest, httpservletrequest.getParameter("pos"));
        httpservletresponse.setContentType("text/html");
        PrintWriter printwriter = httpservletresponse.getWriter();
        HttpSession httpsession = httpservletrequest.getSession(true);
        String s = httpsession.getAttribute("dic_sistema").toString();
        String s1 = httpsession.getAttribute("dic_idioma").toString();
        String s2 = httpservletrequest.getParameter("dic_tabla");
        String s3 = "/kaizen/" + s + "Web.properties";
        props = utilerias.loadProperties(s3);
        url_clases = utilerias.tomaProp("url_clases", props);
        url_ConectAc = url_clases + "/scm/servlet/ConectAc";
        dir_pagInicio = props.getProperty("dir_pagInicio");
        int i = Integer.valueOf(httpservletrequest.getParameter("dic_estado")).intValue();
        String s4 = "";
        String s5 = httpservletrequest1.getParameter("permisos").toString();
        if(i == 8)
            i = utilerias.aEntero(httpservletrequest1.getParameter("edo").toString());
        if(i != 8 && i != 81 && i != 11 && i != 21 && i != 31 && i != 66 && i != 111 && i != 1131 && i != 1141 && i != 119)
            utilerias.insertaBitacora(httpservletrequest, "");
        switch(i)
        {
        case 1: // '\001'
            s4 = frmAlta(s2, s1, httpservletrequest, "1", "11");
            break;

        case 11: // '\013'
            s4 = ejecutaInsert(s2, s1, s5, httpservletrequest, "1", "11");
            break;

        case 2: // '\002'
            s4 = frmModificacion(s2, s1, s5, httpservletrequest, true, true);
            break;

        case 21: // '\025'
            s4 = ejecutaDelete(s2, s1, s5, httpservletrequest);
            break;

        case 3: // '\003'
            s4 = frmModificacion(s2, s1, s5, httpservletrequest, false, false);
            break;

        case 31: // '\037'
            s4 = ejecutaUpdate(s2, s1, s5, httpservletrequest);
            break;

        case 4: // '\004'
            s4 = frmModificacion(s2, s1, s5, httpservletrequest, true, false);
            break;

        case 6: // '\006'
            s4 = frmSqr(s2, s1, httpservletrequest);
            break;

        case 66: // 'B'
            s4 = ejecutaSQR(s2, s1, httpservletrequest);
            break;

        case 7: // '\007'
            s4 = frmBusqueda(s2, s1, httpservletrequest, "7", "77");
            break;

        case 77: // 'M'
            s4 = ejecutaBusqueda(s2, s1, s5, httpservletrequest, "7", "77");
            break;

        case 82: // 'R'
            s4 = frmReporte(s2, s1, httpservletrequest, s5);
            break;

        case 100: // 'd'
            s4 = frmAlta(s2, s1, httpservletrequest, "100", "111");
            break;

        case 111: // 'o'
            s4 = ejecutaProceso(s2, s1, s5, httpservletrequest);
            break;

        case 112: // 'p'
            s4 = frmReporteForma(s2, s1, httpservletrequest, s5);
            break;

        case 113: // 'q'
            s4 = frmAlta(s2, s1, httpservletrequest, "113", "1131");
            break;

        case 1131: 
            s4 = ejecutaAltayModForma(s2, s1, s5, httpservletrequest, "113", "1131", false);
            break;

        case 114: // 'r'
            s4 = frmModificacionForma(s2, s1, s5, httpservletrequest, false, false);
            break;

        case 1141: 
            s4 = ejecutaAltayModForma(s2, s1, s5, httpservletrequest, "113", "1131", true);
            break;

        case 115: // 's'
            s4 = frmModificacionForma(s2, s1, s5, httpservletrequest, true, false);
            break;

        case 116: // 't'
            s4 = frmBusqueda(s2, s1, httpservletrequest, "116", "117");
            break;

        case 117: // 'u'
            s4 = ejecutaBusqueda(s2, s1, s5, httpservletrequest, "116", "117");
            break;

        case 118: // 'v'
            s4 = frmModificacionForma(s2, s1, s5, httpservletrequest, true, true);
            break;

        case 119: // 'w'
            s4 = ejecutaDeleteForma(s2, s1, s5, httpservletrequest);
            break;
        }
        printwriter.println(s4);
    }

    private String ejecutaAltayModForma(String s, String s1, String s2, HttpServletRequest httpservletrequest, String s3, String s4, boolean flag)
        throws IOException
    {
        String s5 = "";
        String s8 = "";
        String s9 = "";
        Vector vector = utilerias.obtieneDiccionario(s, s1, true, httpservletrequest);
        if(FuncEng.cambioLlaves(vector, httpservletrequest))
        {
            String s10;
            if(flag)
                s10 = frmModificacionForma(s, s1, s2, httpservletrequest, false, false);
            else
                s10 = frmAlta(s, s1, httpservletrequest, s3, s4);
            return s10;
        }
        if(vector.size() == 0)
            return utilerias.generaMsg("No existen registros en la tabla: " + s, httpservletrequest);
        for(int i = 0; i < vector.size(); i++)
        {
            String as[] = (String[])vector.elementAt(i);
            String s6 = "";
            String s15 = as[utilerias.DIC_BD_CAMPO];
            String s17 = as[utilerias.DIC_HTML_TIPOCAMPO];
            String s19 = as[utilerias.DIC_REQUERIDO];
            String s21 = as[utilerias.DIC_BD_TIPOLLAVE];
            String s22 = as[utilerias.DIC_BD_FK];
            String s23 = as[utilerias.DIC_BD_TIPOCAMPO];
            String s24 = as[utilerias.DIC_SQL_INSERT];
            String s25 = as[utilerias.DIC_VALOR_SECUENCIAL];
            if(s24 != null)
            {
                String s26 = "";
                if(flag && s24.trim().toUpperCase().startsWith("NOTFROM"))
                    s24 = "";
                s26 = FunInsertEng.validaFuncionesInsert(s24.trim(), s15.trim(), s, httpservletrequest, s19.trim());
                if(s26.length() > 0)
                {
                    String s11;
                    if(flag)
                        s11 = frmModificacionForma(s, s1, s2, httpservletrequest, false, false);
                    else
                        s11 = frmAlta(s, s1, httpservletrequest, s3, s4);
                    String s29 = s26;
                    s11 = utilerias.replaceString(s11, "<!--error-->", s29);
                    return s11;
                }
                String s7 = s24.trim();
            }
            if(!FuncEng.validaRequeridos(vector, httpservletrequest))
            {
                String s12;
                if(flag)
                    s12 = frmModificacionForma(s, s1, s2, httpservletrequest, false, false);
                else
                    s12 = frmAlta(s, s1, httpservletrequest, s3, s4);
                String s27 = "No se pudo realizar el Alta porque falto capturar algun valor";
                s12 = utilerias.replaceString(s12, "<!--error-->", s27);
                return s12;
            }
            String s28 = FuncEng.validaLongitud(vector, httpservletrequest);
            if(s28.length() > 0)
            {
                String s13;
                if(flag)
                    s13 = frmModificacionForma(s, s1, s2, httpservletrequest, false, false);
                else
                    s13 = frmAlta(s, s1, httpservletrequest, s3, s4);
                String s30 = s28;
                s13 = utilerias.replaceString(s13, "<!--error-->", s30);
                return s13;
            }
            s21 = s21.trim();
            s22 = s22.trim();
        }

        byte byte0 = 0;
        if(flag)
            byte0 = 2;
        String s16 = FuncEng.obtieneStoreTabla(s, byte0, httpservletrequest);
        String s18 = FuncEng.ejecutaProcesoForma(s, s1, httpservletrequest, vector, s16);
        if(s18.length() > 0)
        {
            String s20 = utilerias.generaErrorStore(s18);
            if(s20.trim().equals(":") || s20.trim().length() == 0)
                s20 = "Operaci\363n invalida, consulte la informaci\363n capturada.";
            return utilerias.generaMsg(s20, httpservletrequest);
        } else
        {
            String s14 = frmReporteForma(s, s1, httpservletrequest, s2);
            return s14;
        }
    }

    private String ejecutaBusqueda(String s, String s1, String s2, HttpServletRequest httpservletrequest, String s3, String s4)
        throws IOException
    {
        Vector vector = utilerias.obtieneDiccionario(s, s1, true, httpservletrequest);
        if(vector.size() == 0)
            return utilerias.generaMsg("No existen registros en la tabla: " + s, httpservletrequest);
        if(FuncEng.cambioLlaves(vector, httpservletrequest))
        {
            String s5 = frmBusqueda(s, s1, httpservletrequest, s3, s4);
            return s5;
        }
        String s6 = "";
        String s7 = "";
        for(int i = 0; i < vector.size(); i++)
        {
            String as[] = (String[])vector.elementAt(i);
            String s9 = as[utilerias.DIC_BD_CAMPO];
            String s10 = as[utilerias.DIC_CAMP_BUSQUEDA];
            String s11 = as[utilerias.DIC_ETIQUETA];
            String s12 = as[utilerias.DIC_BD_TIPOCAMPO];
            String s13 = as[utilerias.DIC_BD_FK];
            String s14 = as[utilerias.DIC_SQL_BUSQUEDA];
            if(s10.equals("s"))
            {
                String s15 = httpservletrequest.getParameter(s9);
                if(s13.equals("op"))
                    s14 = FuncEng.generaOpJoinFK(s, s9, s1, true);
                if(s14.length() > 0 && !s15.toLowerCase().trim().equals("todo"))
                {
                    if(s14.startsWith("opc_ad="))
                        s14 = utilerias.generaValDer("|", s14);
                    s14 = s14.trim();
                    if(s14.trim().toUpperCase().startsWith("SELECT"))
                    {
                        String s16 = utilerias.generaValIzq(",", s14);
                        s16 = utilerias.generaValDerLast(" ", s16);
                        if(s16.length() > 0)
                        {
                            String s18 = s15;
                            if(s12.equals("ch"))
                                s18 = "'" + s18 + "'";
                            String s19 = s16 + "=" + s18;
                            String s20 = s14;
                            if(s20.toUpperCase().indexOf("WHERE") > 0)
                            {
                                if(s20.toUpperCase().indexOf("ORDER BY") > 0)
                                {
                                    String s21 = utilerias.generaValIzqLast("ORDER BY", s20);
                                    String s23 = utilerias.generaValDerLast("ORDER BY", s20);
                                    s20 = s21 + " and " + s19 + " order by " + s23;
                                } else
                                {
                                    s20 = s20 + " and " + s19;
                                }
                            } else
                            if(s20.toUpperCase().indexOf("ORDER BY") > 0)
                            {
                                String s22 = utilerias.generaValIzqLast("ORDER BY", s20);
                                String s24 = utilerias.generaValDerLast("ORDER BY", s20);
                                s20 = s22 + " where " + s19 + " order by " + s24;
                            } else
                            {
                                s20 = s20 + " where " + s19;
                            }
                            s20 = FuncEng.validaSQLCombo(s20, httpservletrequest);
                            dbRecord dbrecord = utilerias.registroSqlUni(s20);
                            if(dbrecord != null)
                                s15 = dbrecord.getField(2);
                        }
                    }
                }
                String s17 = s + "." + s9 + "=" + httpservletrequest.getParameter(s9);
                s11 = s11 + " = " + s15;
                if(s6.length() > 0)
                {
                    s6 = s6 + "|";
                    s7 = s7 + ", ";
                }
                s6 = s6 + s17;
                s7 = s7 + s11;
            }
        }

        if(s6.length() > 0)
        {
            HttpSession httpsession = httpservletrequest.getSession(true);
            httpsession.setAttribute("dt_busqueda", s6);
            httpsession.setAttribute("dt_busqueda_et", s7);
        }
        String s8 = "";
        if(s3.equals("116"))
            s8 = frmReporteForma(s, s1, httpservletrequest, s2);
        else
            s8 = frmReporte(s, s1, httpservletrequest, s2);
        return s8;
    }

    private String ejecutaDelete(String s, String s1, String s2, HttpServletRequest httpservletrequest)
        throws IOException
    {
        String s3 = "";
        String s5 = "";
        Vector vector = utilerias.obtieneDiccionario(s, s1, false, httpservletrequest);
        if(vector.size() == 0)
            return utilerias.generaMsg("No existen registros en la tabla: " + s, httpservletrequest);
        for(int i = 0; i < vector.size(); i++)
        {
            String as[] = (String[])vector.elementAt(i);
            String s4 = "";
            String s7 = as[utilerias.DIC_BD_TIPOCAMPO];
            String s8 = as[utilerias.DIC_BD_TIPOLLAVE];
            String s10 = as[utilerias.DIC_BD_FK];
            String s12 = as[utilerias.DIC_BD_CAMPO];
            String s14 = as[utilerias.DIC_SQL_INSERT];
            String s15 = as[utilerias.DIC_SQL_DELETE];
            String s16 = as[utilerias.DIC_MAYUSCULAS];
            if(s14.length() > 0)
                s4 = s14.trim();
            if(s10.startsWith("fk") && !FuncEng.validaAccion(s4, s, httpservletrequest))
                return utilerias.generaMsg("No se pudo realizar la Baja porque no existe la llave foranea.", httpservletrequest);
            if(s8.startsWith("pk"))
            {
                String s17 = utilerias.tomaParametro(s12.trim(), httpservletrequest);
                if(s17 == null)
                    s17 = "";
                if(s16.equals("s"))
                    s17 = s17.toUpperCase();
                if(s5.length() > 0)
                    s5 = s5 + " AND ";
                s5 = s5 + FuncEng.validaTipo(s12.trim(), s17, s7.trim());
            }
            if(s15 != null)
            {
                String s18 = "";
                if(s15.toLowerCase().indexOf("--error--") > 0)
                {
                    s18 = utilerias.generaValDer("--error--", s15);
                    s15 = utilerias.generaValIzq("--error--", s15);
                }
                String s19 = FuncEng.validaDelete(s15, httpservletrequest);
                if(s18.length() > 0 && s19.length() > 0)
                    s19 = s18;
                if(s19.length() > 0)
                    return s19;
            }
        }

        if(s5 != "" && !FuncEng.validaPK(s5, s))
            return utilerias.generaMsg("No se pudo realizar la Baja porque no existe el registro.", httpservletrequest);
        String s6 = "DELETE FROM " + s + " WHERE " + s5;
        try
        {
            if(!DbAppUnivC.execStatement(s6))
            {
                String s20 = utilerias.generaMsg("No se pudo realizar la Baja", httpservletrequest);
                return s20;
            }
        }
        catch(Exception _ex)
        {
            String s21 = utilerias.generaMsg("No se pudo realizar la Baja", httpservletrequest);
            return s21;
        }
        utilerias.insertaBitacora(httpservletrequest, s6);
        int j = 1;
        String s9 = FuncEng.obtieneStoreTabla(s, j, httpservletrequest);
        String s11 = FuncEng.ejecutaProcesoForma(s, s1, httpservletrequest, vector, s9);
        String s13 = "";
        s13 = frmReporte(s, s1, httpservletrequest, s2);
        return s13;
    }

    private String ejecutaDeleteForma(String s, String s1, String s2, HttpServletRequest httpservletrequest)
        throws IOException
    {
        Vector vector = utilerias.obtieneDiccionario(s, s1, false, httpservletrequest);
        if(vector.size() == 0)
            return utilerias.generaMsg("No existen registros en la tabla: " + s, httpservletrequest);
        for(int i = 0; i < vector.size(); i++)
        {
            String as[] = (String[])vector.elementAt(i);
            String s3 = as[utilerias.DIC_BD_CAMPO];
            String s5 = as[utilerias.DIC_REQUERIDO];
            String s7 = as[utilerias.DIC_SQL_DELETE];
            if(s7.length() > 0)
                if(s7.toLowerCase().startsWith("noentablas="))
                {
                    String s10 = "";
                    String s12 = utilerias.generaValDer("noEnTablas=", s7);
                    if(s12.toLowerCase().indexOf("--error--") >= 0)
                    {
                        s10 = utilerias.generaValDer("--error--", s12);
                        s12 = utilerias.generaValIzq("--error--", s12);
                    }
                    String s13 = FuncEng.validaDelete(s12, httpservletrequest);
                    if(s13.length() > 0)
                        if(s10.length() > 0)
                            return s10;
                        else
                            return s13;
                } else
                {
                    String s11 = FunInsertEng.validaFuncionesInsert(s7, s3, s, httpservletrequest, s5);
                    if(s11.length() > 0)
                        return s11;
                }
        }

        int j = 1;
        String s4 = FuncEng.obtieneStoreTabla(s, j, httpservletrequest);
        String s6 = FuncEng.ejecutaProcesoForma(s, s1, httpservletrequest, vector, s4);
        if(s6.length() > 0)
        {
            String s8 = utilerias.generaErrorStore(s6);
            if(s8.trim().equals(":") || s8.trim().length() == 0)
                s8 = "Operaci\363n invalida, consulte la informaci\363n capturada.";
            return utilerias.generaMsg(s8, httpservletrequest);
        } else
        {
            String s9 = frmReporteForma(s, s1, httpservletrequest, s2);
            return s9;
        }
    }

    private String ejecutaInsert(String s, String s1, String s2, HttpServletRequest httpservletrequest, String s3, String s4)
        throws IOException
    {
        String s5 = "";
        String s7 = "";
        Vector vector = utilerias.obtieneDiccionario(s, s1, false, httpservletrequest);
        if(FuncEng.cambioLlaves(vector, httpservletrequest))
        {
            String s8 = frmAlta(s, s1, httpservletrequest, s3, s4);
            return s8;
        }
        if(vector.size() == 0)
            return utilerias.generaMsg("No existen registros en la tabla: " + s, httpservletrequest);
        for(int i = 0; i < vector.size(); i++)
        {
            String as[] = (String[])vector.elementAt(i);
            String s6 = "";
            String s11 = as[utilerias.DIC_BD_CAMPO];
            String s13 = as[utilerias.DIC_HTML_TIPOCAMPO];
            String s15 = as[utilerias.DIC_REQUERIDO];
            String s17 = as[utilerias.DIC_BD_TIPOLLAVE];
            String s19 = as[utilerias.DIC_BD_FK];
            String s20 = as[utilerias.DIC_BD_TIPOCAMPO];
            String s21 = as[utilerias.DIC_SQL_INSERT];
            String s22 = as[utilerias.DIC_VALOR_SECUENCIAL];
            String s23 = as[utilerias.DIC_MAYUSCULAS];
            if(s21.length() > 0)
            {
                String s24 = FunInsertEng.validaFuncionesInsert(s21.trim(), s11.trim(), s, httpservletrequest, s15.trim());
                if(s24.length() > 0)
                {
                    String s27 = frmAlta(s, s1, httpservletrequest, s3, s4);
                    String s32 = s24;
                    s27 = utilerias.replaceString(s27, "<!--error-->", s32);
                    return s27;
                }
                s6 = s21.trim();
            }
            if(!FuncEng.validaRequeridos(vector, httpservletrequest))
            {
                String s25 = frmAlta(s, s1, httpservletrequest, s3, s4);
                String s28 = "No se pudo realizar el Alta porque falto capturar algun valor";
                s25 = utilerias.replaceString(s25, "<!--error-->", s28);
                return s25;
            }
            String s26 = FuncEng.validaLongitud(vector, httpservletrequest);
            if(s26.length() > 0)
            {
                String s29 = frmAlta(s, s1, httpservletrequest, s3, s4);
                String s33 = s26;
                s29 = utilerias.replaceString(s29, "<!--error-->", s33);
                return s29;
            }
            if(s19.startsWith("fk") && !FuncEng.validaAccion(s6, s, httpservletrequest))
            {
                String s30 = "No se pudo realizar el Alta porque no existe la llave foranea";
                String s34 = frmAlta(s, s1, httpservletrequest, s3, s4);
                s34 = utilerias.replaceString(s34, "<!--error-->", s30);
                return s34;
            }
            if(s17.startsWith("pk"))
            {
                String s31 = utilerias.tomaParametro(s11.trim(), httpservletrequest);
                if(s13.trim().startsWith("sec"))
                {
                    String s35 = s22;
                    if(s35 != null)
                    {
                        s35 = FuncEng.validaSQLCombo(s35, httpservletrequest);
                        String s36 = utilerias.valorSqlUni(s35);
                        if(s36 != null)
                            s31 = s36;
                    }
                }
                if(s23.equals("s"))
                    s31 = s31.toUpperCase();
                if(s7 != "")
                    s7 = s7 + " AND ";
                s7 = s7 + FuncEng.validaTipo(s11.trim(), s31, s20.trim());
            }
        }

        if(s7 != "" && FuncEng.validaPK(s7, s))
        {
            String s9 = frmAlta(s, s1, httpservletrequest, s3, s4);
            String s12 = "No se pudo realizar el Alta porque se duplicarian los registros.";
            s9 = utilerias.replaceString(s9, "<!--error-->", s12);
            return s9;
        }
        String s10 = "INSERT INTO " + s + " (" + FuncEng.obtieneCamposInsert(vector) + ") VALUES (" + FuncEng.obtieneValores(vector, httpservletrequest) + ")";
        try
        {
            if(!DbAppUnivC.execStatement(s10))
            {
                String s37 = utilerias.generaMsg("Error SQL: No se pudo realizar el Alta", httpservletrequest);
                return s37;
            }
        }
        catch(Exception _ex)
        {
            String s38 = utilerias.generaMsg("Error SQL: No se pudo realizar el Alta", httpservletrequest);
            return s38;
        }
        utilerias.insertaBitacora(httpservletrequest, s10);
        int j = 0;
        String s14 = FuncEng.obtieneStoreTabla(s, j, httpservletrequest);
        String s16 = FuncEng.ejecutaProcesoForma(s, s1, httpservletrequest, vector, s14);
        String s18 = frmReporte(s, s1, httpservletrequest, s2);
        return s18;
    }

    private String ejecutaProceso(String s, String s1, String s2, HttpServletRequest httpservletrequest)
        throws IOException
    {
        String s3 = "";
        Vector vector = utilerias.obtieneDiccionario(s, s1, true, httpservletrequest);
        if(FuncEng.cambioLlaves(vector, httpservletrequest))
        {
            String s4 = frmAlta(s, s1, httpservletrequest, "100", "111");
            return s4;
        }
        String s5 = FuncEng.tomaCampoTabla(s, httpservletrequest, 18);
        if(s5.startsWith("url="))
        {
            String s6 = utilerias.generaValDer("url=", s5);
            s6 = FuncEng.validaSQLCombo(s6, httpservletrequest);
            s3 = "redirect27" + s6;
        } else
        if(s5.startsWith("store="))
        {
            String s7 = "";
            if(s5.indexOf("--redirect--") > 0)
            {
                s7 = utilerias.tomaValorLinea(s5, "--redirect--", "--");
                s7 = FuncEng.validaSQLCombo(s7, httpservletrequest);
                s5 = utilerias.generaValIzq("--redirect--", s5);
            }
            String s8 = utilerias.generaValDer("store=", s5);
            String s9 = FuncEng.ejecutaProcesoTabla(s8, s, s1, httpservletrequest, vector);
            if(s9.length() > 0)
            {
                if(s9.indexOf("ORA-") >= 0)
                    s9 = "OPERACION INVALIDA, CONSULTE LA INFORMACION CAPTURADA";
                s3 = utilerias.generaMsg(s9, httpservletrequest);
            } else
            if(s7.length() > 0)
                s3 = "redirect27" + s7;
            else
                s3 = utilerias.generaMsg("Proceso ejecutado con \351xito", httpservletrequest);
        } else
        {
            s3 = utilerias.generaMsg("Proceso Desconocido", httpservletrequest);
        }
        utilerias.insertaBitacora(httpservletrequest, s3);
        return s3;
    }

    private String ejecutaSQR(String s, String s1, HttpServletRequest httpservletrequest)
        throws IOException
    {
        String s2 = utilerias.tomaParametro("sqrMail_pregunta", httpservletrequest);
        String s3 = utilerias.tomaParametro("sqrMail_texto", httpservletrequest);
        if(s2 == null)
            s2 = "";
        if(s3 == null)
            s3 = "";
        boolean flag = s2.startsWith("1") && s3.trim().length() == 0;
        String s4 = utilerias.tomaParametro("dic_sistema", httpservletrequest);
        String s5 = "/kaizen/" + s4 + "Web.properties";
        String s6 = "";
        Vector vector = utilerias.obtieneDiccionario(s, s1, false, httpservletrequest);
        Vector vector1 = utilerias.obtieneTabla(s, httpservletrequest);
        dbRecord dbrecord = (dbRecord)vector1.elementAt(0);
        String s7 = dbrecord.getField(10);
        if(s7 == null)
            s7 = "";
        s7 = s7.trim();
        if(vector.size() == 0)
            return utilerias.generaMsg("No existen registros en la tabla: " + s, httpservletrequest);
        if(FuncEng.cambioLlaves(vector, httpservletrequest))
        {
            String s8 = frmSqr(s, s1, httpservletrequest);
            return s8;
        }
        for(int i = 0; i < vector.size(); i++)
        {
            String as[] = (String[])vector.elementAt(i);
            if(!FuncEng.validaRequeridos(vector, httpservletrequest))
            {
                String s9 = frmSqr(s, s1, httpservletrequest);
                String s11 = "Atenci\363n, Capture los campos que son requeridos.";
                s9 = utilerias.replaceString(s9, "<!--error-->", s11);
                return s9;
            }
        }

        int j = 0;
        String s10 = props.getProperty("sqrSepParam");
        String s12 = "";
        if(s7.length() > 0)
        {
            s12 = s7;
            for(int k = 0; k < vector.size(); k++)
            {
                String as1[] = (String[])vector.elementAt(k);
                String s15 = as1[utilerias.DIC_BD_CAMPO];
                String s18 = utilerias.tomaParametro(s15, httpservletrequest);
                if(s18 == null)
                    s18 = "";
                String s20 = as1[utilerias.DIC_HTML_TIPOCAMPO];
                if(s20.startsWith("lista"))
                    s18 = templates.obtieneValoresLista(s15, httpservletrequest);
                else
                if(s20.equals("fecha"))
                {
                    String s23 = props.getProperty("mascaraFechaSqr");
                    s18 = utilerias.formateaFechaMascara(s18, s23);
                } else
                if(s20.equals("check") && s4.equals("mocte") && s18.length() == 0)
                    s18 = "N";
                s15 = "-" + s15 + "-";
                s12 = utilerias.replaceString(s12, s15, s18);
            }

        } else
        {
            for(int l = 0; l < vector.size(); l++)
            {
                j++;
                String as2[] = (String[])vector.elementAt(l);
                String s16 = as2[utilerias.DIC_BD_CAMPO];
                String s19 = as2[utilerias.DIC_SQRPARAMETRO];
                String s21 = as2[utilerias.DIC_HTML_TIPOCAMPO];
                if(!s16.startsWith("reporte") && s19.equals("s"))
                {
                    if(s12.length() > 0)
                        s12 = s12 + s10;
                    if(s21.equals("lista"))
                    {
                        String s24 = templates.obtieneValoresLista(s16, httpservletrequest);
                        s12 = s12 + s24;
                    } else
                    {
                        String s25 = utilerias.tomaParametro(s16, httpservletrequest);
                        if(s25 == null)
                            s25 = "";
                        if(s21.equals("fecha"))
                        {
                            String s27 = props.getProperty("mascaraFechaSqr");
                            s25 = utilerias.formateaFechaMascara(s25, s27);
                        }
                        s12 = s12 + s25;
                    }
                }
            }

        }
        String s13 = props.getProperty("sqr_dirRepSalida");
        String s14 = props.getProperty("sqr_tipoSalida");
        s12 = s12.toUpperCase();
        if(s12.trim().length() == 0)
            s12 = "NINGUNO";
        String s17 = "0";
        HttpSession httpsession = httpservletrequest.getSession(false);
        String s22 = httpsession.getAttribute("usuario").toString();
        String s26 = httpsession.getAttribute("password").toString();
        String s28 = utilerias.tomaParametro("reporte", httpservletrequest);
        String s29 = utilerias.fechaHoy();
        s29 = utilerias.configuraFechaInsert(s29);
        String s30 = FuncEng.obtieneSalidaSqr(s, httpservletrequest);
        s30 = s30.trim();
        String s31 = "4";
        String s32 = "\\";
        String s33 = props.getProperty("sistema_operativo");
        if(s33.trim().equals("unix"))
            s32 = "/";
        if(s2.startsWith("1") && s3.trim().length() > 0)
        {
            s31 = "0";
            String s34 = "pro_calcula";
            if(s30.toUpperCase().indexOf(s34.toUpperCase()) < 0)
                s13 = s13 + "batch" + s32;
        }
        if(s30.length() > 0)
        {
            if(s30.indexOf("_frm.htm") > 0)
            {
                String s35 = utilerias.replaceString(s30, "_frm.htm", ".pdf");
                if(!s33.trim().equals("unix"))
                    s35 = utilerias.replaceString(s35, "/", s32);
                s13 = s13 + s35;
            } else
            {
                s13 = s13 + s30;
            }
        } else
        {
            s13 = s13 + s28 + s32 + s28 + ".pdf";
        }
        s13 = utilerias.replaceString1(s13, "\\n", "\\\\n");
        String s36 = "select   max(pid)  from pid  ";
        Vector vector2 = DbAppUnivC.execQuery(s36);
        String s37;
        if(vector.isEmpty())
        {
            s37 = null;
        } else
        {
            dbRecord dbrecord1 = (dbRecord)vector2.elementAt(0);
            s37 = dbrecord1.getField(1);
        }
        String s38 = "";
        String s39 = "";
        if(s37 == null)
        {
            s39 = "1";
            s38 = "insert into pid  values (" + s39 + ")";
        } else
        {
            String s40 = s37;
            int i1 = Integer.valueOf(s40).intValue();
            s39 = String.valueOf(++i1);
            s38 = "update pid set pid  = '" + s39 + "' where pid = " + s40;
        }
        String s41 = "insert into procesos (usuario, modulo, servidor, pid, parametros, fecha_ini, destino, comando, formato, estatus, arch_prop, mail_usr)";
        s41 = s41 + " values('" + s22 + "','" + s28 + "', 'web'," + s39 + ",'" + s12 + "',";
        s41 = s41 + s29 + ",'" + s13 + "','" + s14 + "', 0," + s31 + ", '" + s5 + "', '" + s3 + "')";
        try
        {
            if(!DbAppUnivC.execStatement(s38))
            {
                String s46 = "Error SQL: Error al tratar de insertar pid";
                return s46;
            }
            if(!DbAppUnivC.execStatement(s41))
            {
                String s47 = "Error SQL: Error al tratar insertar proceso de sqr";
                return s47;
            }
        }
        catch(Exception _ex)
        {
            String s48 = "Error SQL: Error al tratar de insertar pid y procesos sqr";
            return s48;
        }
        utilerias.insertaBitacora(httpservletrequest, s28);
        if(s2.startsWith("1") && s3.trim().length() > 0)
        {
            String s42 = "?pid=" + s39;
            String s44 = url_clases + "/scm/servlet/ExSqrMail" + s42;
            templates.generaPlantilla(s44, httpservletrequest);
            return utilerias.generaMsg("El reporte fue enviado por mail", httpservletrequest);
        }
        String s43 = "?reporte=" + s28;
        s43 = s43 + "&usuario=" + s22;
        s43 = s43 + "&salidaEsp=" + s30;
        s43 = s43 + "&sPid=" + s39;
        s43 = s43 + "&escenario=" + s17;
        s43 = s43 + "&arch_prop=" + s5;
        s43 = s43 + "&pwd=" + s26;
        try
        {
            String s45 = url_clases + "/scm/servlet/ExSqrServlet" + s43;
            s6 = templates.generaPlantilla(s45, httpservletrequest);
            if(s6.length() == 0)
            {
                String s49 = utilerias.generaError("ERROR 0028, Longitud 0", httpservletrequest);
                return s49;
            }
        }
        catch(Exception _ex)
        {
            String s50 = utilerias.generaError("ERROR 0028, Excepcion General", httpservletrequest);
            return s50;
        }
        return s6;
    }

    private String ejecutaUpdate(String s, String s1, String s2, HttpServletRequest httpservletrequest)
        throws IOException
    {
        String s3 = "";
        String s5 = "";
        Vector vector = utilerias.obtieneDiccionario(s, s1, false, httpservletrequest);
        if(vector.size() == 0)
            return utilerias.generaMsg("No existen registros en la tabla: " + s + "<br>", httpservletrequest);
        if(cambioNK(vector, httpservletrequest))
        {
            String s6 = frmModificacion(s, s1, s2, httpservletrequest, false, false);
            return s6;
        }
        for(int i = 0; i < vector.size(); i++)
        {
            String as[] = (String[])vector.elementAt(i);
            String s4 = "";
            String s8 = as[utilerias.DIC_BD_TIPOCAMPO];
            String s9 = as[utilerias.DIC_BD_TIPOLLAVE];
            String s11 = as[utilerias.DIC_BD_FK];
            String s13 = as[utilerias.DIC_BD_CAMPO];
            String s15 = as[utilerias.DIC_REQUERIDO];
            String s16 = as[utilerias.DIC_SQL_INSERT];
            String s17 = as[utilerias.DIC_MAYUSCULAS];
            if(s16 != null)
            {
                String s18 = FunInsertEng.validaFuncionesInsert(s16.trim(), s13.trim(), s, httpservletrequest, s15.trim());
                if(s18.length() > 0)
                {
                    String s21 = frmModificacion(s, s1, s2, httpservletrequest, false, false);
                    String s25 = s18;
                    s21 = utilerias.replaceString(s21, "<!--error-->", s25);
                    return s21;
                }
                s4 = s16.trim();
            }
            if(!FuncEng.validaRequeridos(vector, httpservletrequest))
            {
                String s19 = frmModificacion(s, s1, s2, httpservletrequest, false, false);
                String s22 = "No se pudo realizar la Modificacion porque falto capturar algun valor";
                s19 = utilerias.replaceString(s19, "<!--error-->", s22);
                return s19;
            }
            String s20 = FuncEng.validaLongitud(vector, httpservletrequest);
            if(s20.length() > 0)
            {
                String s23 = frmModificacion(s, s1, s2, httpservletrequest, false, false);
                String s26 = s20;
                s23 = utilerias.replaceString(s23, "<!--error-->", s26);
                return s23;
            }
            if(s11.startsWith("fk") && !FuncEng.validaAccion(s4, s, httpservletrequest))
                return utilerias.generaMsg("No se pudo realizar la Modificacion porque no existe la llave foranea.", httpservletrequest);
            if(s9.startsWith("pk"))
            {
                String s24 = utilerias.tomaParametro(s13.trim(), httpservletrequest);
                if(s24 == null)
                    s24 = "";
                if(s17.equals("s"))
                    s24 = s24.toUpperCase();
                if(s5 != "")
                    s5 = s5 + " AND ";
                s5 = s5 + FuncEng.validaTipo(s13.trim(), s24, s8.trim());
            }
        }

        if(s5 != "" && !FuncEng.validaPK(s5, s))
            return utilerias.generaMsg("No se pudo realizar la Modificacion porque no existe el registro.", httpservletrequest);
        String s7 = "UPDATE " + s + " SET " + FuncEng.obtieneCamposValores(vector, httpservletrequest) + " WHERE " + s5;
        try
        {
            if(!DbAppUnivC.execStatement(s7))
            {
                String s27 = utilerias.generaMsg("No se pudo realizar la Modificacion", httpservletrequest);
                return s27;
            }
        }
        catch(Exception _ex)
        {
            String s28 = utilerias.generaMsg("No se pudo realizar la Modificacion", httpservletrequest);
            return s28;
        }
        utilerias.insertaBitacora(httpservletrequest, s7);
        byte byte0 = 2;
        String s10 = FuncEng.obtieneStoreTabla(s, byte0, httpservletrequest);
        String s12 = FuncEng.ejecutaProcesoForma(s, s1, httpservletrequest, vector, s10);
        String s14 = "";
        if(FuncEng.isTablaDetalle(s, httpservletrequest))
            s14 = frmModificacion(s, s1, s2, httpservletrequest, false, false);
        else
            s14 = frmReporte(s, s1, httpservletrequest, s2);
        return s14;
    }

    private String frmAlta(String s, String s1, HttpServletRequest httpservletrequest, String s2, String s3)
        throws IOException
    {
        String s4 = "";
        Vector vector = new Vector();
        Vector vector1 = new Vector();
        String s5 = "";
        String s6 = props.getProperty("dir_EngineAc");
        String s7 = props.getProperty("texto_Requerido");
        String s8 = s3;
        boolean flag = true;
        boolean flag1 = true;
        String s9 = props.getProperty("texto_Alta");
        int i = 0;
        int j = templates.ALTAS;
        if(s2.equals("100"))
        {
            s9 = "Ejecutar";
            j = templates.PROCESO;
        }
        Vector vector2 = utilerias.obtieneDiccionario(s, s1, true, httpservletrequest);
        if(vector2.size() == 0)
            return utilerias.generaMsg("No existen registros en la tabla: " + s, httpservletrequest);
        for(int k = 0; k < vector2.size(); k++)
        {
            String as[] = (String[])vector2.elementAt(k);
            String s11 = "";
            String s12 = "";
            String s13 = as[utilerias.DIC_BD_TIPOCAMPO];
            String s14 = as[utilerias.DIC_HTML_TIPOCAMPO];
            String s15 = as[utilerias.DIC_BD_TIPOLLAVE];
            String s16 = as[utilerias.DIC_BD_FK];
            String s17 = as[utilerias.DIC_BD_CAMPO];
            String s18 = as[utilerias.DIC_REQUERIDO];
            String s19 = as[utilerias.DIC_ETIQUETA];
            String s20 = as[utilerias.DIC_SQL_JOINFK];
            String s21 = as[utilerias.DIC_VALOR_INICIAL];
            String s22 = as[utilerias.DIC_MUESTRA_CAMPO];
            String s23 = as[utilerias.DIC_BD_LONGITUD];
            String s24 = as[utilerias.DIC_HTML_ANCHO];
            String s25 = as[utilerias.DIC_HTML_ORDEN];
            String s26 = as[utilerias.DIC_ENCRIPTADO];
            String s27 = as[utilerias.DIC_HTML_LINEAS];
            String s28 = "";
            boolean flag2 = true;
            if(utilerias.tieneValorReg(s22))
            {
                String s29 = s22;
                flag2 = FuncEng.muestraCampo(s29, s17, s, httpservletrequest);
            }
            if(flag2)
            {
                if(s18.equals("s"))
                    s11 = s11 + "* ";
                s11 = s11 + s19 + ": ";
                if(httpservletrequest != null)
                {
                    s20 = FuncEng.validaSQLCombo(s20, httpservletrequest);
                    s28 = utilerias.tomaParametro(s17, httpservletrequest);
                }
                if(s21.length() > 0)
                {
                    String s30 = utilerias.tomaParametro(s17, httpservletrequest);
                    if(s30 != null && !s14.equals("etiq"))
                        s28 = s30;
                    else
                        s28 = FuncEng.evaluaValorInicial(s21, httpservletrequest);
                    String s33 = s28;
                    if(s28.indexOf("|") >= 0)
                    {
                        s33 = utilerias.generaValDer("|", s28);
                        s28 = utilerias.generaValIzq("|", s28);
                    }
                    if((s13.equals("sm") || s13.equals("de")) && s28 == null)
                        s28 = "0";
                    if(s14.equals("etiq"))
                        s5 = s5 + templates.generaHidden(s17, s33);
                }
                if(s14.startsWith("lista") && s20.indexOf("--consulta--") > 0)
                    s20 = utilerias.generaValIzq("--consulta--", s20);
                if(s14.startsWith("etiq"))
                    s20 = "";
                if(s16.equals("op"))
                    s20 = FuncEng.generaOpJoinFK(s, s17, s1, true);
                if((s15.equals("pk") || s15.equals("nk")) && (s14.equals("menu") || s14.equals("fecha")))
                {
                    String s31 = utilerias.validaNulo(utilerias.tomaParametro(s17, httpservletrequest));
                    if(s31.length() == 0)
                    {
                        i++;
                        if(s14.startsWith("menu") && k + 1 < vector2.size())
                            s14 = "jump";
                    } else
                    if(utilerias.variableEnSesion(s17, httpservletrequest))
                    {
                        s14 = "etiq";
                        s5 = s5 + templates.generaHidden(s17, utilerias.tomaParametro(s17, httpservletrequest));
                    } else
                    {
                        if(s14.startsWith("menu") && k + 1 < vector2.size())
                            s14 = "jump";
                        s5 = s5 + templates.generaHidden("llave_" + s17, utilerias.tomaParametro(s17, httpservletrequest));
                    }
                }
                if(s14.equals("sec"))
                {
                    s5 = s5 + templates.generaHidden(s17, s28);
                    s12 = "";
                    s11 = "";
                } else
                {
                    if(s15.equals("pk") || s15.equals("nk") || s16.equals("op") || s16.equals("fk"))
                    {
                        s12 = templates.generaHTML(s17, s14, s23, s24, s27, s20, s28, s25, httpservletrequest);
                    } else
                    {
                        if(s14.equals("detalle"))
                        {
                            String s32 = as[utilerias.DIC_SQL_DETALLE];
                            s20 = s32;
                        }
                        s12 = templates.generaHTMLVFijo(s17, s14, s23, s24, s27, s20, s28, s25, httpservletrequest);
                    }
                    if(s13.equals("etiq"))
                        s12 = s12 + templates.generaHidden(s17, s28);
                }
            }
            vector.addElement(s11);
            vector1.addElement(s12);
        }

        if(i >= 1)
        {
            s8 = s2;
            s9 = "Continuar";
            flag = false;
        }
        String s10 = "";
        if(flag && s8.equals("11") && FuncEng.isTablaDetalle(s, httpservletrequest))
            s10 = detalleReporte(s, s1, httpservletrequest, "M");
        s5 = s5 + templates.generaHidden("dic_estado", s8);
        s5 = s5 + generaHiddensMenus(httpservletrequest);
        s5 = s5 + templates.generaHidden("dic_tabla", s);
        s4 = templates.generaPantalla(vector, vector1, s6, s9, s, j, s5, s7, s10, "", flag1, "", httpservletrequest);
        return s4;
    }

    private String frmBusqueda(String s, String s1, HttpServletRequest httpservletrequest, String s2, String s3)
        throws IOException
    {
        String s4 = "";
        Vector vector = new Vector();
        Vector vector1 = new Vector();
        String s5 = "";
        String s6 = props.getProperty("dir_EngineAc");
        String s7 = "";
        String s8 = s3;
        boolean flag = true;
        boolean flag2 = true;
        String s9 = "Buscar";
        int i = 0;
        Vector vector2 = utilerias.obtieneDiccionario(s, s1, true, httpservletrequest);
        if(vector2.size() == 0)
            return utilerias.generaMsg("No existen registros en la tabla: " + s, httpservletrequest);
        for(int j = 0; j < vector2.size(); j++)
        {
            String as[] = (String[])vector2.elementAt(j);
            String s11 = "";
            String s12 = "";
            String s14 = as[utilerias.DIC_BD_TIPOCAMPO];
            String s15 = as[utilerias.DIC_HTML_TIPOCAMPO];
            String s17 = as[utilerias.DIC_BD_TIPOLLAVE];
            String s18 = as[utilerias.DIC_BD_FK];
            String s19 = as[utilerias.DIC_BD_CAMPO];
            String s20 = as[utilerias.DIC_ETIQUETA];
            String s21 = as[utilerias.DIC_SQL_JOINFK];
            String s23 = as[utilerias.DIC_BD_LONGITUD];
            String s24 = as[utilerias.DIC_HTML_ANCHO];
            String s25 = as[utilerias.DIC_HTML_ORDEN];
            String s26 = as[utilerias.DIC_HTML_LINEAS];
            String s27 = as[utilerias.DIC_CAMP_BUSQUEDA];
            String s28 = as[utilerias.DIC_SQL_BUSQUEDA];
            String s29 = "";
            if(s27.equals("s"))
            {
                String s22;
                if(s18.equals("op"))
                {
                    s22 = FuncEng.generaOpJoinFK(s, s19, s1, true);
                    if(s28.startsWith("opc_ad="))
                        s22 = s28 + " | " + s22;
                } else
                {
                    s22 = s28;
                    if(s22.trim().startsWith("opc_ad="))
                        s17 = "";
                }
                String s16 = "menu";
                s11 = s11 + s20 + ": ";
                if(httpservletrequest != null)
                {
                    s22 = FuncEng.validaSQLCombo(s22, httpservletrequest);
                    s29 = utilerias.tomaParametro(s19, httpservletrequest);
                }
                if((s17.equals("pk") || s17.equals("nk")) && (s16.equals("menu") || s16.equals("fecha")))
                {
                    String s30 = utilerias.validaNulo(utilerias.tomaParametro(s19, httpservletrequest));
                    if(s30.length() == 0)
                    {
                        i++;
                        if(s16.startsWith("menu") && j + 1 < vector2.size())
                            s16 = "jump";
                    } else
                    if(utilerias.variableEnSesion(s19, httpservletrequest))
                    {
                        s16 = "etiq";
                        s5 = s5 + templates.generaHidden(s19, utilerias.tomaParametro(s19, httpservletrequest));
                    } else
                    {
                        if(s16.equals("menu") && j + 1 < vector2.size())
                            s16 = "jump";
                        s5 = s5 + templates.generaHidden("llave_" + s19, utilerias.tomaParametro(s19, httpservletrequest));
                    }
                }
                String s13;
                if(s17.equals("pk") || s17.equals("nk") || s18.equals("op") || s18.equals("fk"))
                {
                    s13 = templates.generaHTML(s19, s16, s23, s24, s26, s22, s29, s25, httpservletrequest);
                } else
                {
                    if(s16.equals("detalle"))
                    {
                        String s31 = as[utilerias.DIC_SQL_DETALLE];
                        s22 = s31;
                    }
                    s13 = templates.generaHTMLVFijo(s19, s16, s23, s24, s26, s22, s29, s25, httpservletrequest);
                }
                if(s14.equals("etiq"))
                    s13 = s13 + templates.generaHidden(s19, s29);
                vector.addElement(s11);
                vector1.addElement(s13);
            }
        }

        if(i >= 1)
        {
            s8 = s2;
            s9 = "Continuar";
            boolean flag1 = false;
        }
        String s10 = "";
        s5 = s5 + templates.generaHidden("dic_estado", s8);
        s5 = s5 + generaHiddensMenus(httpservletrequest);
        s5 = s5 + templates.generaHidden("dic_tabla", s);
        s5 = s5 + templates.generaHidden("dic_acc_bus", "1");
        s4 = templates.generaPantalla(vector, vector1, s6, s9, s, templates.BUSQUEDA, s5, s7, s10, "", flag2, "", httpservletrequest);
        return s4;
    }

    private String frmModificacion(String s, String s1, String s2, HttpServletRequest httpservletrequest, boolean flag, boolean flag1)
        throws IOException
    {
        String s3 = "";
        String s4 = "";
        Vector vector = new Vector();
        Vector vector1 = new Vector();
        String s5 = "";
        String s6 = "";
        String s7 = url_ConectAc;
        String s8 = "Modificar";
        String s9 = "";
        String s10 = "31";
        Vector vector2 = utilerias.obtieneDiccionario(s, s1, false, httpservletrequest);
        String s11 = "SELECT " + FuncEng.obtieneCampos(vector2) + " from " + s + " where " + FuncEng.obtieneValoresPK(vector2, httpservletrequest);
        Vector vector3 = DbAppUnivC.execQuery(s11);
        if(vector2.size() == 0 || vector3.size() == 0)
            return utilerias.generaMsg("No existen registros en la tabla: " + s, httpservletrequest);
        boolean flag2 = false;
        dbRecord dbrecord = (dbRecord)vector3.elementAt(0);
        for(int i = 0; i < vector2.size(); i++)
        {
            String s12 = "";
            String s14 = "";
            String as[] = (String[])vector2.elementAt(i);
            String s17 = as[utilerias.DIC_BD_TIPOCAMPO];
            String s19 = as[utilerias.DIC_BD_TIPOLLAVE];
            String s20 = as[utilerias.DIC_BD_FK];
            String s21 = as[utilerias.DIC_BD_CAMPO];
            String s22 = as[utilerias.DIC_REQUERIDO];
            String s23 = as[utilerias.DIC_ETIQUETA];
            String s24 = as[utilerias.DIC_SQL_JOINFK];
            String s25 = as[utilerias.DIC_BD_LONGITUD];
            String s26 = as[utilerias.DIC_HTML_ANCHO];
            String s27 = as[utilerias.DIC_HTML_ORDEN];
            String s28 = as[utilerias.DIC_SQL_SELECT];
            String s29 = as[utilerias.DIC_SQL_INSERT];
            String s30 = as[utilerias.DIC_HTML_TIPOCAMPO];
            String s31 = as[utilerias.DIC_MUESTRA_CAMPO];
            String s32 = as[utilerias.DIC_HTML_LINEAS];
            boolean flag3 = true;
            if(flag)
            {
                if(!s30.equals("detalle") && !s30.startsWith("listasl") && !s30.equals("textarea"))
                {
                    s30 = "etiq";
                } else
                {
                    if(s30.startsWith("listasl"))
                        s30 = "det_lista";
                    if(s30.equals("textarea"))
                        s30 = "consulta_textarea";
                }
                if(s24.startsWith("opc_ad="))
                    s24 = utilerias.generaValDer("|", s24);
            }
            if(s31 != null)
                flag3 = FuncEng.muestraCampo(s31, s21, s, httpservletrequest);
            if(flag3)
            {
                if(s22.trim().startsWith("s"))
                    s12 = s12 + "* ";
                s12 = s12 + s23.trim() + ": ";
                if(s19.startsWith("pk"))
                {
                    if(utilerias.tomaParametro(s21.trim(), httpservletrequest) != null && utilerias.tomaParametro(s21.trim(), httpservletrequest) != "")
                    {
                        s5 = s5 + templates.generaHidden(s21.trim(), utilerias.tomaParametro(s21.trim(), httpservletrequest));
                        s6 = s6 + templates.generaHidden(s21.trim(), utilerias.tomaParametro(s21.trim(), httpservletrequest));
                        s24 = FuncEng.quitaCamposTilde(s24);
                        String s33 = FuncEng.validaSQLCombo(s24, httpservletrequest);
                        s33 = utilerias.validaJoinFk(s33, httpservletrequest);
                        if(s20.startsWith("fk") || s20.startsWith("op"))
                        {
                            if(s20.startsWith("op"))
                                s33 = FuncEng.generaOpJoinFK(s, s21, s1, false);
                            s14 = s14 + FuncEng.obieneValorLlave(s21.trim(), utilerias.tomaParametro(s21.trim(), httpservletrequest), s17.trim(), s33);
                        } else
                        {
                            s14 = s14 + utilerias.tomaParametro(s21.trim(), httpservletrequest);
                        }
                        if(s4 != "")
                            s4 = s4 + " AND ";
                        s4 = s4 + FuncEng.validaTipo(s21.trim(), utilerias.tomaParametro(s21.trim(), httpservletrequest), s17.trim());
                    } else
                    {
                        if(s24 == null)
                        {
                            if(s28 != null)
                            {
                                String s34 = s28.trim();
                                s34 = FuncEng.validaSQLCombo(s34, httpservletrequest);
                                s14 = s14 + templates.generaHTML(s21, "jump", s25, s26, s32, s34, "", s27, httpservletrequest);
                            }
                        } else
                        {
                            String s35 = FuncEng.validaSQLCombo(s24, httpservletrequest);
                            s14 = s14 + templates.generaHTML(s21, "jump", s25, s26, s32, s35, "", s27, httpservletrequest);
                        }
                        s10 = "3";
                        s8 = "Continuar";
                        i = vector2.size();
                    }
                } else
                if(s20.startsWith("fk") || s20.startsWith("op"))
                {
                    if(s20.startsWith("op"))
                        s24 = FuncEng.generaOpJoinFK(s, s21, s1, true);
                    s24 = FuncEng.validaSQLCombo(s24, httpservletrequest);
                    String s36 = dbrecord.getField(i + 1);
                    if(s36 == null)
                        s36 = "";
                    else
                        s36 = s36.trim();
                    String s38 = utilerias.tomaParametro(s21, httpservletrequest);
                    if(s38 != null)
                        s36 = s38;
                    String s40 = s30;
                    if(s19.startsWith("nk"))
                    {
                        s5 = s5 + templates.generaHidden("nk_" + s21, s36);
                        if(s40.startsWith("menu"))
                            s40 = "jump";
                    }
                    s14 = s14 + templates.generaHTMLVFijo(s21, s40, s25, s26, s32, s24, s36, s27, httpservletrequest);
                    flag2 = true;
                } else
                {
                    String s37 = dbrecord.getField(i + 1);
                    if(s37 == null)
                        s37 = "";
                    else
                        s37 = s37.trim();
                    String s39 = utilerias.tomaParametro(s21, httpservletrequest);
                    if(s39 != null)
                        s37 = s39;
                    if(s30.startsWith("etiq") || s30.startsWith("sec"))
                        s14 = s14 + templates.generaHidden(s21, s37);
                    s14 = s14 + templates.generaHTMLVFijo(s21, s30, s25, s26, s32, "", s37, s27, httpservletrequest);
                    flag2 = true;
                }
                vector.addElement(s12);
                vector1.addElement(s14);
            } else
            {
                vector1.addElement("");
                vector.addElement("");
            }
        }

        String s13 = "";
        if(flag2 && FuncEng.isTablaDetalle(s, httpservletrequest))
            s13 = detalleReporte(s, s1, httpservletrequest, "M");
        s5 = s5 + templates.generaHidden("dic_tabla", s);
        s5 = s5 + templates.generaHidden("dic_estado", s10);
        s5 = s5 + templates.generaHidden("rp_count", utilerias.tomaParametro("rp_count", httpservletrequest));
        s5 = s5 + templates.generaHidden("dic_orden", utilerias.tomaParametro("dic_orden", httpservletrequest));
        s5 = s5 + generaHiddensMenus(httpservletrequest);
        s6 = s6 + templates.generaHidden("dic_tabla", s);
        String s15 = s6;
        s15 = s15 + templates.generaHidden("dic_estado", "1");
        s15 = s15 + generaHiddensMenus(httpservletrequest);
        s6 = s6 + templates.generaHidden("dic_estado", "21");
        s6 = s6 + generaHiddensMenus(httpservletrequest);
        String s16 = "";
        if(s2.indexOf("B") >= 0)
            s16 = templates.generaForma(s6, url_ConectAc, "Borrar");
        if(httpservletrequest.getParameter("dic_acc_bus") != null)
            s5 = s5 + templates.generaHidden("dic_acc_bus", "1");
        String s18 = "";
        s9 = s9 + "<br> Los campos marcados con un \"*\" son requeridos. <br>";
        int j = templates.MODIFICACION;
        if(flag)
        {
            j = templates.CONSULTA;
            s7 = "";
            s9 = "";
        }
        if(flag1)
            j = templates.BAJAS;
        else
            s16 = "";
        s3 = templates.generaPantalla(vector, vector1, s7, s8, s, j, s5, s9, s13, s16, true, s18, httpservletrequest);
        return s3;
    }

    private String frmModificacionForma(String s, String s1, String s2, HttpServletRequest httpservletrequest, boolean flag, boolean flag1)
        throws IOException
    {
        String s3 = "";
        String s4 = "";
        String s6 = "";
        String s8 = "";
        Vector vector = new Vector();
        Vector vector1 = new Vector();
        String s9 = "";
        String s10 = "";
        String s11 = url_ConectAc;
        String s12 = "Modificar";
        String s13 = "";
        String s14 = "1141";
        Vector vector2 = utilerias.obtieneDiccionario(s, s1, true, httpservletrequest);
        String s15 = FuncEng.obtieneStoreTabla(s, 3, httpservletrequest);
        s15 = FuncEng.validaSQLCombo(s15, httpservletrequest);
        Vector vector3 = DbAppUnivC.execQuery(s15);
        if(vector2.size() == 0)
            return utilerias.generaMsg("JF_forms-001: No existen registros en el diccionario, tabla: " + s, httpservletrequest);
        if(vector3.size() == 0)
            return utilerias.generaMsg("JF_forms-002: No existen registros en la consulta para la modificacion " + vector3.size() + " , tabla: " + s, httpservletrequest);
        boolean flag2 = false;
        dbRecord dbrecord = (dbRecord)vector3.elementAt(0);
        int i = 0;
        for(int j = 0; j < vector2.size(); j++)
        {
            String s5 = "";
            String s7 = "";
            String s16 = "";
            String s18 = "";
            String as[] = (String[])vector2.elementAt(j);
            String s21 = as[utilerias.DIC_BD_TIPOCAMPO];
            String s22 = as[utilerias.DIC_BD_TIPOLLAVE];
            String s23 = as[utilerias.DIC_BD_FK];
            String s24 = as[utilerias.DIC_BD_CAMPO];
            String s25 = as[utilerias.DIC_REQUERIDO];
            String s26 = as[utilerias.DIC_ETIQUETA];
            String s27 = as[utilerias.DIC_SQL_JOINFK];
            String s29 = as[utilerias.DIC_BD_LONGITUD];
            String s30 = as[utilerias.DIC_HTML_ANCHO];
            String s31 = as[utilerias.DIC_HTML_ORDEN];
            String s32 = as[utilerias.DIC_SQL_SELECT];
            String s33 = as[utilerias.DIC_SQL_INSERT];
            String s34 = as[utilerias.DIC_HTML_TIPOCAMPO];
            String s35 = as[utilerias.DIC_MUESTRA_CAMPO];
            String s36 = as[utilerias.DIC_HTML_LINEAS];
            String s37 = as[utilerias.DIC_CAMPO_INFORMATIVO];
            boolean flag4 = false;
            if(flag)
            {
                if(!s34.equals("detalle") && !s34.startsWith("listasl") && !s34.equals("textarea"))
                {
                    s34 = "etiq";
                } else
                {
                    if(s34.startsWith("listasl"))
                        s34 = "det_lista";
                    if(s34.equals("textarea"))
                        s34 = "consulta_textarea";
                }
                if(s27.startsWith("opc_ad="))
                    s27 = utilerias.generaValDer("|", s27);
            }
            if(s37.equals("s"))
                flag4 = true;
            else
                i++;
            boolean flag5 = true;
            if(s35 != null)
                flag5 = FuncEng.muestraCampo(s35, s24, s, httpservletrequest);
            if(flag5)
            {
                if(s25.startsWith("s"))
                    s16 = s16 + "* ";
                s16 = s16 + s26.trim() + ": ";
                if(s22 != null)
                    s5 = s22.trim();
                if(s23 != null)
                    s7 = s23.trim();
                if(s5.startsWith("pk"))
                {
                    if(utilerias.tomaParametro(s24.trim(), httpservletrequest) != null && utilerias.tomaParametro(s24.trim(), httpservletrequest) != "")
                    {
                        s9 = s9 + templates.generaHidden(s24.trim(), utilerias.tomaParametro(s24.trim(), httpservletrequest));
                        s10 = s10 + templates.generaHidden(s24.trim(), utilerias.tomaParametro(s24.trim(), httpservletrequest));
                        s27 = FuncEng.quitaCamposTilde(s27);
                        String s38 = FuncEng.validaSQLCombo(s27, httpservletrequest);
                        s38 = utilerias.validaJoinFk(s38, httpservletrequest);
                        if(s7.startsWith("fk") || s7.startsWith("op"))
                        {
                            if(s7.startsWith("op"))
                                s38 = FuncEng.generaOpJoinFK(s, s24, s1, false);
                            String s43 = FuncEng.obieneValorLlave(s24.trim(), utilerias.tomaParametro(s24.trim(), httpservletrequest), s21.trim(), s38);
                            if(s43.trim().length() == 0)
                                s43 = utilerias.tomaParametro(s24.trim(), httpservletrequest);
                            s18 = s18 + s43;
                        } else
                        {
                            s18 = s18 + utilerias.tomaParametro(s24.trim(), httpservletrequest);
                        }
                        if(s8 != "")
                            s8 = s8 + " AND ";
                        s8 = s8 + FuncEng.validaTipo(s24.trim(), utilerias.tomaParametro(s24.trim(), httpservletrequest), s21.trim());
                    } else
                    {
                        if(s27.length() == 0)
                        {
                            if(s32 != null)
                            {
                                String s39 = s32.trim();
                                s39 = FuncEng.validaSQLCombo(s39, httpservletrequest);
                                s18 = s18 + templates.generaHTML(s24, "jump", s29, s30, s36, s39, "", s31, httpservletrequest);
                            }
                        } else
                        {
                            String s40 = FuncEng.validaSQLCombo(s27, httpservletrequest);
                            s18 = s18 + templates.generaHTML(s24, "jump", s29, s30, s36, s40, "", s31, httpservletrequest);
                        }
                        s14 = "114";
                        s12 = "Continuar";
                        j = vector2.size();
                    }
                } else
                if(s7.startsWith("fk") || s7.startsWith("op"))
                {
                    if(s7.startsWith("op"))
                        s27 = FuncEng.generaOpJoinFK(s, s24, s1, true);
                    s27 = FuncEng.validaSQLCombo(s27, httpservletrequest);
                    String s41 = "";
                    if(!flag4)
                        s41 = dbrecord.getField(i);
                    if(s41 == null)
                        s41 = "";
                    else
                        s41 = s41.trim();
                    String s44 = utilerias.tomaParametro(s24, httpservletrequest);
                    if(s44 != null)
                        s41 = s44;
                    String s46 = s34;
                    if(s5.startsWith("nk"))
                    {
                        s9 = s9 + templates.generaHidden("llave_" + s24, s41);
                        if(s46.startsWith("menu"))
                        {
                            s46 = "jump";
                            s9 = s9 + templates.generaHidden("llave_" + s24, s41);
                        }
                    }
                    if(s34.equals("detalle"))
                    {
                        String s48 = as[utilerias.DIC_SQL_DETALLE];
                        s27 = s48;
                    }
                    s18 = s18 + templates.generaHTMLVFijo(s24, s46, s29, s30, s36, s27, s41, s31, httpservletrequest);
                    boolean flag3 = true;
                } else
                {
                    String s42 = "";
                    if(!flag4)
                        s42 = dbrecord.getField(i);
                    if(s42 == null)
                        s42 = "";
                    else
                        s42 = s42.trim();
                    String s45 = utilerias.tomaParametro(s24, httpservletrequest);
                    if(s45 != null)
                        s42 = s45;
                    if(s34.startsWith("etiq") || s34.startsWith("sec"))
                        s18 = s18 + templates.generaHidden(s24, s42);
                    String s28;
                    if(s34.equals("detalle"))
                    {
                        String s47 = as[utilerias.DIC_SQL_DETALLE];
                        s28 = s47;
                    } else
                    {
                        s28 = "";
                    }
                    s18 = s18 + templates.generaHTMLVFijo(s24, s34, s29, s30, s36, s28, s42, s31, httpservletrequest);
                }
                vector.addElement(s16);
                vector1.addElement(s18);
            } else
            {
                vector1.addElement("");
                vector.addElement("");
            }
        }

        s10 = s10 + s9;
        s9 = s9 + templates.generaHidden("dic_tabla", s);
        s9 = s9 + templates.generaHidden("dic_estado", s14);
        s9 = s9 + generaHiddensMenus(httpservletrequest);
        String s17 = "";
        s17 = s17 + templates.generaHidden("rp_count", utilerias.tomaParametro("rp_count", httpservletrequest));
        s17 = s17 + templates.generaHidden("dic_orden", utilerias.tomaParametro("dic_orden", httpservletrequest));
        if(httpservletrequest.getParameter("dic_acc_bus") != null)
            s17 = s17 + templates.generaHidden("dic_acc_bus", "1");
        s9 = s9 + s17;
        s10 = s10 + templates.generaHidden("dic_tabla", s);
        s10 = s10 + templates.generaHidden("dic_estado", "119");
        s10 = s10 + s17;
        s10 = s10 + generaHiddensMenus(httpservletrequest);
        String s19 = "";
        if(s2.indexOf("B") >= 0)
            s19 = templates.generaForma(s10, url_ConectAc, "Borrar");
        String s20 = "";
        s13 = s13 + "<br> Los campos marcados con un \"*\" son requeridos. <br>";
        int k = templates.MODIFICACION;
        if(flag)
        {
            k = templates.CONSULTA;
            s11 = "";
            s13 = "";
        }
        if(flag1)
            k = templates.BAJAS;
        else
            s19 = "";
        s3 = templates.generaPantalla(vector, vector1, s11, s12, s, k, s9, s13, "", s19, true, s20, httpservletrequest);
        return s3;
    }

    private String frmReporte(String s, String s1, HttpServletRequest httpservletrequest, String s2)
        throws IOException
    {
        if(s2.indexOf("R") < 0)
            return "";
        String s3 = "";
        Vector vector = new Vector();
        Vector vector1 = new Vector();
        String s4 = "";
        String s5 = url_ConectAc;
        String s6 = "Generar Reporte";
        String s7 = "";
        String s8 = "";
        String s9 = "";
        String s10 = httpservletrequest.getParameter("dic_acc_bus");
        String s11 = utilerias.tomaParametro("dic_orden", httpservletrequest);
        if(s11 != null && s11.equals("null"))
            s11 = null;
        if(s11 == null)
            s11 = utilerias.tomaParametro("orden", httpservletrequest);
        boolean flag = false;
        int i = 0;
        if(FunInsertEng.fncNum("rp_count", httpservletrequest).length() == 0)
            i = Integer.valueOf(utilerias.tomaParametro("rp_count", httpservletrequest)).intValue();
        Vector vector2 = utilerias.obtieneDiccionario(s, s1, false, httpservletrequest);
        if(vector2.size() == 0)
            return utilerias.generaMsg("No existen registros en la tabla: " + s, httpservletrequest);
        Vector vector3 = FuncEng.obtieneRegRep(vector2, false);
        String s12 = templates.generaComboJumpRep("orden", vector3, s11, false);
        s9 = s9 + "Ordenado por : " + s12;
        s8 = s8 + templates.generaHidden("dic_tabla", s);
        s8 = s8 + templates.generaHidden("dic_estado", "82");
        s8 = s8 + templates.generaHidden("dic_tabla", s);
        s8 = s8 + templates.generaHidden("rp_count", String.valueOf(i));
        s8 = s8 + generaHiddensMenus(httpservletrequest);
        if(s10 != null)
            s8 = s8 + templates.generaHidden("dic_acc_bus", "1");
        String s13 = templates.generaFormaSinBoton(s9 + s8, url_ConectAc);
        Vector vector4 = new Vector();
        Vector vector5 = new Vector();
        String s14 = "";
        for(int j = 0; j < vector3.size(); j++)
        {
            String as[] = (String[])vector3.elementAt(j);
            vector4.addElement(as[utilerias.DIC_ETIQUETA]);
            if(j == 0)
                s14 = "1";
        }

        flag = true;
        String s15 = FuncEng.generaSelect(vector2, s, s1, httpservletrequest);
        String s16 = FuncEng.tomaCampoTabla(s, httpservletrequest, 4);
        String s17 = s16;
        String s18 = "";
        if(s16.indexOf("--busqueda--") >= 0)
        {
            s17 = utilerias.generaValIzq("--busqueda--", s16);
            s18 = utilerias.generaValDer("--busqueda--", s16);
        }
        if(s17.trim().length() > 0)
        {
            if(s15.toUpperCase().indexOf("WHERE") > 0)
                s17 = " and " + s17;
            else
                s17 = " where " + s17;
            s15 = s15 + " " + s17;
            s15 = FuncEng.validaSQLCombo(s15, httpservletrequest);
            s15 = FuncEng.validaSQLComboSesion(s15, httpservletrequest);
            s15 = utilerias.validaJoinFk(s15, httpservletrequest);
            s15 = s15.trim();
            if(s15.toLowerCase().endsWith(" and"))
                s15 = s15.substring(0, s15.length() - 3);
            if(s15.toLowerCase().endsWith(" where"))
                s15 = s15.substring(0, s15.length() - 5);
        }
        String s19 = "";
        if(s10 != null)
        {
            s19 = "&dic_acc_bus=1";
            String s20 = utilerias.tomaParametroSesion("dt_busqueda_et", httpservletrequest);
            if(s20 == null)
                s20 = "";
            s7 = "Res de Busqueda <b>" + s20 + "</b><br>";
            if(s18.trim().length() > 0)
            {
                s15 = s15 + " " + s18;
                s15 = FuncEng.validaSQLComboSesion(s15, httpservletrequest);
                s15 = FuncEng.validaSQLComboBusqueda(s, s15, s1, httpservletrequest, vector2);
                s15 = utilerias.validaJoinFk(s15, httpservletrequest);
            }
        }
        if(s11 != null)
            s15 = s15 + " ORDER BY " + s11.trim();
        else
            s15 = s15 + " ORDER BY " + s14;
        s15 = FuncEng.validaSQLCombo(s15, httpservletrequest);
        Vector vector6 = DbAppUnivC.execQuery(s15);
        try
        {
            s19 = s19 + "&dic_menu=" + httpservletrequest.getParameter("dic_menu") + "&dic_submenu=" + httpservletrequest.getParameter("dic_submenu");
        }
        catch(Exception _ex)
        {
            _ex.printStackTrace();
        }
        int k = Integer.valueOf(props.getProperty("rep_max")).intValue();
        int l = i + k;
        if(l > vector6.size())
            l = vector6.size();
        for(int i1 = i; i1 < l; i1++)
        {
            dbRecord dbrecord = (dbRecord)vector6.elementAt(i1);
            String s21 = "";
            int j1 = 1;
            for(int k1 = 1; k1 <= vector2.size(); k1++)
            {
                String as1[] = (String[])vector2.elementAt(k1 - 1);
                int l1 = vector4.size() + j1;
                String s24 = dbrecord.getField(l1);
                String s25 = as1[utilerias.DIC_BD_TIPOLLAVE];
                if(s25.equals("pk") || s25.equals("nk"))
                {
                    if(s24 == null)
                        s24 = "";
                    else
                        s24 = s24.trim();
                    s21 = templates.generaRef(s21, as1[2], s24);
                    j1++;
                }
            }

            s21 = templates.generaRef(s21, "dic_tabla", s);
            s21 = templates.generaRef(s21, "rp_count", String.valueOf(i));
            s21 = templates.generaRef(s21, "dic_orden", s11);
            s21 = s21 + s19;
            vector5.addElement(s21);
        }

        boolean flag1 = false;
        if(s2.indexOf("M") >= 0)
            flag1 = true;
        if(s11 == null)
            s11 = s14;
        String s22 = generaTablaReporte(vector4, vector6, vector5, vector4.size(), flag1, s2, i, s, s11, k, null, null, null, "82", "", "3", "2", "4", "0", s19, null, url_ConectAc);
        String s23 = utilerias.obtieneDescDic(s, httpservletrequest);
        s3 = templates.generaPantalla(s, templates.FRMREPORTE, s7, s22, s23, s13, httpservletrequest);
        return s3;
    }

    private String frmReporteForma(String s, String s1, HttpServletRequest httpservletrequest, String s2)
        throws IOException
    {
        if(s2.indexOf("R") < 0)
            return "";
        String s3 = "";
        Vector vector = new Vector();
        Vector vector1 = new Vector();
        String s4 = "";
        String s5 = url_ConectAc;
        String s6 = "Generar Reporte";
        String s7 = "";
        String s8 = "";
        String s9 = "";
        String s10 = httpservletrequest.getParameter("dic_acc_bus");
        String s11 = utilerias.tomaParametro("dic_orden", httpservletrequest);
        if(s11 != null && s11.equals("null"))
            s11 = null;
        if(s11 == null)
            s11 = utilerias.tomaParametro("orden", httpservletrequest);
        boolean flag = false;
        int i = 0;
        if(FunInsertEng.fncNum("rp_count", httpservletrequest).length() == 0)
            i = Integer.valueOf(utilerias.tomaParametro("rp_count", httpservletrequest)).intValue();
        Vector vector2 = utilerias.obtieneDiccionario(s, s1, false, httpservletrequest);
        if(vector2.size() == 0)
            return utilerias.generaMsg("No existen registros en la tabla: " + s, httpservletrequest);
        Vector vector3 = FuncEng.obtieneRegRep(vector2, false);
        String s12 = templates.generaComboJumpRep("orden", vector3, s11, false);
        s9 = s9 + "Ordenado por : " + s12;
        s8 = s8 + templates.generaHidden("dic_tabla", s);
        s8 = s8 + templates.generaHidden("dic_estado", "112");
        s8 = s8 + templates.generaHidden("dic_tabla", s);
        s8 = s8 + templates.generaHidden("rp_count", String.valueOf(i));
        s8 = s8 + generaHiddensMenus(httpservletrequest);
        if(s10 != null)
            s8 = s8 + templates.generaHidden("dic_acc_bus", "1");
        String s13 = templates.generaFormaSinBoton(s9 + s8, url_ConectAc);
        Vector vector4 = new Vector();
        Vector vector5 = new Vector();
        String s14 = "1";
        for(int j = 0; j < vector3.size(); j++)
        {
            String as[] = (String[])vector3.elementAt(j);
            vector4.addElement(as[utilerias.DIC_ETIQUETA]);
        }

        flag = true;
        String s15 = FuncEng.tomaCampoTabla(s, httpservletrequest, 16);
        String s16 = "";
        if(s10 != null)
        {
            s15 = FuncEng.validaSQLComboSesion(s15, httpservletrequest);
            s15 = FuncEng.validaSQLComboBusqueda(s, s15, s1, httpservletrequest, vector2);
            s16 = "&dic_acc_bus=1";
            HttpSession httpsession = httpservletrequest.getSession(true);
            String s17 = "";
            if(httpsession.getAttribute("dt_busqueda_et") != null)
                s17 = httpsession.getAttribute("dt_busqueda_et").toString();
            s7 = "Res. de Busqueda: <b>" + s17 + "</b><br>";
        }
        s15 = FuncEng.validaSQLCombo(s15, httpservletrequest);
        s15 = utilerias.validaJoinFk(s15, httpservletrequest);
        if(s11 != null)
            s15 = s15 + " ORDER BY " + s11.trim();
        else
            s15 = s15 + " ORDER BY " + s14;
        Vector vector6 = DbAppUnivC.execQuery(s15);
        String s18 = FuncEng.tomaCampoTabla(s, httpservletrequest, 17);
        Vector vector7 = new Vector();
        if(s18.trim().length() > 0)
            vector7 = utilerias.generaVectorStr(s18, "\246");
        int k = Integer.valueOf(props.getProperty("rep_max")).intValue();
        int l = i + k;
        if(l > vector6.size())
            l = vector6.size();
        Vector vector8 = new Vector();
        Vector vector9 = new Vector();
        try
        {
            s16 = s16 + "&dic_menu=" + httpservletrequest.getParameter("dic_menu") + "&dic_submenu=" + httpservletrequest.getParameter("dic_submenu");
        }
        catch(Exception _ex)
        {
            _ex.printStackTrace();
        }
        for(int i1 = i; i1 < l; i1++)
        {
            dbRecord dbrecord = (dbRecord)vector6.elementAt(i1);
            String s20 = "";
            int j1 = 1;
            for(int k1 = 1; k1 <= vector2.size(); k1++)
            {
                String as1[] = (String[])vector2.elementAt(k1 - 1);
                int l1 = vector4.size() + j1;
                String s25 = dbrecord.getField(l1);
                String s26 = as1[utilerias.DIC_BD_TIPOLLAVE];
                if(s26.equals("pk") || s26.equals("nk"))
                {
                    String s27 = as1[4];
                    if(s25 == null)
                        s25 = "";
                    else
                        s25 = s25.trim();
                    s20 = templates.generaRef(s20, as1[2], s25);
                    j1++;
                }
            }

            Vector vector10 = new Vector();
            Vector vector11 = new Vector();
            if(vector7.size() > 0)
                vector10 = FuncEng.generaLinkAd(vector7, dbrecord, httpservletrequest);
            vector8.addElement(vector10);
            s20 = templates.generaRef(s20, "dic_tabla", s);
            s20 = templates.generaRef(s20, "rp_count", String.valueOf(i));
            s20 = templates.generaRef(s20, "dic_orden", s11);
            s20 = s20 + s16;
            vector5.addElement(s20);
        }

        String s19 = url_clases + "/scm/servlet/";
        String s21 = "ConectAc";
        String s22 = FuncEng.claseAparte(s, httpservletrequest);
        if(s22.length() > 0)
            s21 = s22;
        s19 = s19 + s21;
        boolean flag1 = false;
        if(s2.indexOf("M") >= 0)
            flag1 = true;
        if(s11 == null)
            s11 = s14;
        String s23 = generaTablaReporte(vector4, vector6, vector5, vector4.size(), flag1, s2, i, s, s11, k, null, null, null, "112", "", "114", "118", "115", "0", s16, vector8, s19);
        String s24 = utilerias.obtieneDescDic(s, httpservletrequest);
        s3 = templates.generaPantalla(s, templates.FRMREPORTE, s7, s23, s24, s13, httpservletrequest);
        return s3;
    }

    private String frmSqr(String s, String s1, HttpServletRequest httpservletrequest)
        throws IOException
    {
        String s2 = "";
        Vector vector = new Vector();
        Vector vector1 = new Vector();
        String s3 = "";
        String s4 = props.getProperty("dir_EngineAc");
        String s5 = props.getProperty("texto_Requerido");
        String s6 = "66";
        boolean flag = true;
        String s7 = props.getProperty("texto_Sqr");
        int i = 0;
        boolean flag1 = true;
        boolean flag2 = false;
        Vector vector2 = utilerias.obtieneDiccionario(s, s1, true, httpservletrequest);
        if(vector2.size() == 0)
            return utilerias.generaMsg("No existen registros en la tabla: " + s, httpservletrequest);
        for(int j = 0; j < vector2.size(); j++)
        {
            String as[] = (String[])vector2.elementAt(j);
            String s9 = "";
            String s10 = "";
            String s11 = as[utilerias.DIC_BD_TIPOCAMPO];
            String s12 = as[utilerias.DIC_HTML_TIPOCAMPO];
            String s13 = as[utilerias.DIC_BD_TIPOLLAVE];
            String s14 = as[utilerias.DIC_BD_FK];
            String s15 = as[utilerias.DIC_BD_CAMPO];
            String s16 = as[utilerias.DIC_REQUERIDO];
            String s17 = as[utilerias.DIC_ETIQUETA];
            String s18 = as[utilerias.DIC_SQL_JOINFK];
            String s19 = as[utilerias.DIC_VALOR_INICIAL];
            String s20 = as[utilerias.DIC_BD_LONGITUD];
            String s21 = as[utilerias.DIC_HTML_ANCHO];
            String s22 = as[utilerias.DIC_HTML_ORDEN];
            String s23 = as[utilerias.DIC_HTML_LINEAS];
            String s24 = "";
            boolean flag4 = true;
            if(utilerias.tieneValorReg(as[utilerias.DIC_MUESTRA_CAMPO]))
            {
                String s25 = as[utilerias.DIC_MUESTRA_CAMPO];
                flag4 = FuncEng.muestraCampo(s25, s15, s, httpservletrequest);
            }
            if(flag4)
            {
                if(s16.equals("s"))
                    s9 = s9 + "* ";
                s9 = s9 + s17 + ": ";
                if(httpservletrequest != null)
                {
                    s18 = FuncEng.validaSQLCombo(s18, httpservletrequest);
                    s24 = utilerias.tomaParametro(s15, httpservletrequest);
                }
                if(utilerias.tieneValorReg(as[utilerias.DIC_VALOR_INICIAL]) && utilerias.tomaParametro(s15, httpservletrequest) == null)
                {
                    s24 = FuncEng.evaluaValorInicial(s19, httpservletrequest);
                    if((s11.equals("sm") || s11.equals("de")) && s24 == null)
                        s24 = "0";
                    if(s12.equals("etiq"))
                        s3 = s3 + templates.generaHidden(s15, s24);
                }
                if(s14.equals("op"))
                    s18 = FuncEng.generaOpJoinFK(s, s15, s1, true);
                if((s13.equals("pk") || s13.equals("nk")) && (s12.equals("menu") || s12.equals("fecha")))
                {
                    String s26 = utilerias.validaNulo(utilerias.tomaParametro(s15, httpservletrequest));
                    if(s26.length() == 0)
                    {
                        flag2 = true;
                        i++;
                        if(s12.startsWith("menu") && j + 1 < vector2.size())
                            s12 = "jump";
                    } else
                    if(utilerias.variableEnSesion(s15, httpservletrequest))
                    {
                        s12 = "etiq";
                        s3 = s3 + templates.generaHidden(s15, utilerias.tomaParametro(s15, httpservletrequest));
                    } else
                    {
                        if(s12.startsWith("menu") && j + 1 < vector2.size())
                            s12 = "jump";
                        s3 = s3 + templates.generaHidden("llave_" + s15, utilerias.tomaParametro(s15, httpservletrequest));
                    }
                }
                if(s12.equals("sec"))
                {
                    s3 = s3 + templates.generaHidden(s15, s24);
                    s10 = "";
                    s9 = "";
                } else
                {
                    if(!flag1)
                        s18 = "";
                    if(s13.equals("pk") || s13.equals("nk") || s14.equals("op") || s14.equals("fk"))
                        s10 = templates.generaHTML(s15, s12, s20, s21, s23, s18, s24, s22, httpservletrequest);
                    else
                        s10 = templates.generaHTMLVFijo(s15, s12, s20, s21, s23, s18, s24, s22, httpservletrequest);
                    if(s12.startsWith("etiq"))
                        s10 = s10 + templates.generaHidden(s15, s24);
                }
            }
            vector.addElement(s9);
            vector1.addElement(s10);
            if(flag2 && flag1)
                flag1 = false;
        }

        if(i >= 1)
        {
            s6 = "6";
            s7 = "Continuar";
        }
        String s8 = "";
        s8 = "<tr><td>" + templates.generaHTMLVFijo("sqrMail_pregunta", "check", "5", "5", "0", "", "0", "0", httpservletrequest) + " </td>";
        s8 = s8 + "<td>Mail:</td>";
        s8 = s8 + "<td>" + templates.generaHTMLVFijo("sqrMail_texto", "texto", "100", "30", "0", "", "", "0", httpservletrequest) + "</td></tr>";
        s8 = templates.tabla("0", s8, "");
        s3 = s3 + templates.generaHidden("dic_estado", s6);
        s3 = s3 + generaHiddensMenus(httpservletrequest);
        s3 = s3 + templates.generaHidden("dic_tabla", s);
        boolean flag3 = false;
        s2 = templates.generaPantalla(vector, vector1, s4, s7, s, templates.REPORTE, s3, s5, "", "", flag, "", httpservletrequest);
        return s2;
    }

    private String generaFromsAd(String s, String s1)
    {
        String s2 = "";
        String as[] = new String[6];
        as[0] = "=";
        as[1] = ">";
        as[2] = "<";
        as[3] = ">=";
        as[4] = "<=";
        as[5] = "<>";
        for(int i = 0; i < 6; i++)
            s1 = utilerias.replaceStringOnLine(s1, as[i], " " + as[i] + " ");

        s1 = utilerias.replaceStringOnLine(s1, "  ", " ");
        Vector vector = utilerias.generaVectorStr(s1, "and");
        for(int j = 0; j < vector.size(); j++)
        {
            String s3 = (String)vector.elementAt(j);
            if(s3.indexOf(".") > 0)
            {
                String s4 = utilerias.generaValIzq(".", s3);
                if(s.toUpperCase().indexOf(s4.toUpperCase()) < 0)
                    if(s2.trim().length() > 0)
                        s2 = s2 + ", " + s4;
                    else
                        s2 = s4;
            }
        }

        return s2;
    }

    public String generaHiddensMenus(HttpServletRequest httpservletrequest)
    {
        String s = "";
        try
        {
            s = s + templates.generaHidden("dic_menu", httpservletrequest.getParameter("dic_menu").toString());
            s = s + templates.generaHidden("dic_submenu", httpservletrequest.getParameter("dic_submenu").toString());
        }
        catch(Exception _ex)
        {
            _ex.printStackTrace();
        }
        return s;
    }

    private String generaHiddensRepDetalle(Vector vector, HttpServletRequest httpservletrequest)
    {
        String s = "";
        for(int i = 0; i < vector.size(); i++)
        {
            String as[] = (String[])vector.elementAt(i);
            String s1 = as[3];
            if(s1 != null)
            {
                String s2 = as[2];
                String s3 = utilerias.tomaParametro(s2, httpservletrequest);
                if(s3 != null)
                    s = s + templates.generaHidden(s2, s3);
            }
        }

        return s;
    }

    private String generaSelectDetalle(Vector vector, String s, HttpServletRequest httpservletrequest, String s1, String s2)
        throws IOException
    {
        String s3 = "";
        s = s.trim();
        String s4 = s;
        String s5 = "";
        int i = 0;
        String s6 = "";
        for(int j = 0; j < vector.size(); j++)
        {
            String as[] = (String[])vector.elementAt(j);
            String s7 = as[15];
            String s8 = as[3];
            String s10 = as[4];
            if(s7 != null)
                s7 = s7.trim();
            else
                s7 = "";
            String s11 = s + "." + as[2];
            String s12 = "";
            boolean flag = false;
            String s13 = as[19];
            if(s13 != null && s13.startsWith("s"))
                flag = true;
            if(flag)
            {
                if(as[18] != null)
                    s12 = as[18];
                if(as[16] != null || s12.startsWith("s"))
                {
                    String s14 = "";
                    String s16 = "";
                    if(as[16] != null)
                    {
                        if(as[16].length() > 0)
                        {
                            s11 = as[16];
                            String s19 = "";
                            if(s11.indexOf("|") > 0)
                            {
                                s19 = utilerias.generaValDer("|", s11);
                                s11 = utilerias.generaValIzq("|", s11);
                            }
                            s4 = s4 + " , " + utilerias.generaValIzq(".", s11);
                            if(s19.length() == 0)
                                s19 = as[2];
                            s14 = s + "." + as[2];
                            s16 = utilerias.generaValIzq(".", s11) + "." + utilerias.generaValDer(".", s19);
                        }
                        if(s14.trim().length() > 0)
                            if(s5.length() > 0)
                                s5 = s5 + " and " + s14 + " = " + s16;
                            else
                                s5 = s14 + " = " + s16;
                    }
                    if(s12.startsWith("s"))
                    {
                        String s17 = utilerias.tomaParametro(as[2], httpservletrequest);
                        if(s14.length() == 0)
                            s14 = s11;
                        if(as[4].startsWith("ch") || as[4].startsWith("fe"))
                            s17 = "'" + s17 + "'";
                        if(s14.trim().length() > 0)
                            if(s5.length() > 0)
                                s5 = s5 + " and " + s14 + " = " + s17;
                            else
                                s5 = s14 + " = " + s17;
                    }
                }
                if(s7.startsWith("op") || s7.startsWith("ck"))
                {
                    i++;
                    String s15 = "op" + String.valueOf(i);
                    s11 = s15 + ".opcion";
                    s4 = s4 + " , dt_opciones  " + s15 + " ";
                    if(s5.length() > 0)
                        s5 = s5 + " and ";
                    String s18 = " " + s15 + ".bd_tabla = '" + s + "'";
                    s18 = s18 + " and " + s15 + ".bd_campo = '" + as[2] + "'";
                    s18 = s18 + " and " + s15 + ".idioma = '" + s1 + "'";
                    s18 = s18 + " and " + s15 + ".clave = " + s + "." + as[2];
                    s5 = s5 + s18;
                }
                if(s10.equals("fe"))
                    s11 = utilerias.conFechaNombreCampo(s11);
                if(s3.length() > 0)
                    s3 = s3 + ", " + s11;
                else
                    s3 = s3 + s11;
            }
            if(s6.length() > 0)
                s6 = s6 + ", " + s + "." + as[2];
            else
                s6 = s6 + s + "." + as[2];
        }

        s3 = s3 + "," + s6;
        Vector vector1 = utilerias.obtieneTabla(s, httpservletrequest);
        if(vector1.size() == 0)
            return utilerias.generaMsg("No se encontro la tabla " + s, httpservletrequest);
        dbRecord dbrecord = (dbRecord)vector1.elementAt(0);
        String s9 = "";
        if(dbrecord.getField(4) != null)
        {
            s9 = generaFromsAd(s4, dbrecord.getField(4).trim());
            if(s5.length() > 0)
                s5 = s5 + " and " + dbrecord.getField(4).trim();
            else
                s5 = dbrecord.getField(4).trim();
        }
        if(s5.length() > 0)
            s5 = s5 + " and " + s2 + " ";
        else
            s5 = " " + s2 + " ";
        if(s9.trim().length() > 0)
            if(s4.length() > 0)
                s4 = s4 + ", " + s9;
            else
                s4 = s9;
        if(s5.length() > 0)
            s3 = s3 + " from " + s4 + " where " + s5;
        else
            s3 = s3 + " from " + s4;
        s3 = "select " + s3;
        return s3;
    }

    private String generaTablaReporte(Vector vector, Vector vector1, Vector vector2, int i, boolean flag, String s, int j, 
            String s1, String s2, int k, Vector vector3, Vector vector4, HttpServletRequest httpservletrequest, String s3, 
            String s4, String s5, String s6, String s7, String s8, String s9, Vector vector5, 
            String s10)
        throws IOException
    {
        String s11 = "";
        String s12 = "";
        String s13 = props.getProperty("titColorRen");
        String s14 = props.getProperty("titFont");
        String s15 = props.getProperty("titTamFont");
        String s16 = props.getProperty("titColorFont");
        String s17 = props.getProperty("datColorRen");
        String s18 = props.getProperty("datFont");
        String s19 = props.getProperty("datTamFont");
        String s20 = props.getProperty("datColorFont");
        String s21 = props.getProperty("imgModificar");
        String s22 = props.getProperty("imgBorrar");
        String s23 = props.getProperty("imgConsultar");
        String s24 = props.getProperty("imgDocumento");
        String s25 = props.getProperty("selColorRen");
        String s26 = props.getProperty("imgDetVacio");
        String s27 = props.getProperty("max_txt");
        String s28 = props.getProperty("dir_pagInicio");
        int l = utilerias.aEntero(s27);
        int i1 = j;
        int j1 = j + k;
        if(j1 > vector1.size())
            j1 = vector1.size();
        s12 = s12 + "<tr>";
        for(int k1 = -1; k1 < vector.size(); k1++)
            if(k1 < 0)
                s12 = s12 + templates.tablaCol("&nbsp;", s16, s14, s15, s13);
            else
                s12 = s12 + templates.tablaCol((String)vector.elementAt(k1), s16, s14, s15, s13);

        s12 = s12 + "</tr>";
        int l1 = 0;
        int i2 = j1 - j;
        i2 = k - i2;
        if(j1 < k)
            i2 = 0;
        int j2 = 0;
        int k2 = 0;
        for(int l2 = j; l2 < j1 + i2; l2++)
        {
            dbRecord dbrecord = null;
            dbRecord dbrecord1 = null;
            String s31 = "FFFFFF";
            String s32 = "";
            if(++j2 % 2 != 0)
                s31 = s17;
            if(l2 < j1)
            {
                if(vector4 != null)
                    dbrecord = (dbRecord)vector4.elementAt(l2);
                if(FuncEng.coincideRegistro(vector3, httpservletrequest, dbrecord, i) && utilerias.tomaParametro("avance", httpservletrequest) == null)
                    s31 = s25;
                else
                    s12 = s12 + "<tr>";
                dbrecord1 = (dbRecord)vector1.elementAt(l2);
                s32 = (String)vector2.elementAt(l1);
            } else
            {
                s12 = s12 + "<tr>";
            }
            l1++;
            for(int j3 = 0; j3 <= i; j3++)
            {
                String s35 = "";
                if(l2 < j1)
                {
                    if(j3 == 0)
                    {
                        if(s.indexOf("M") >= 0)
                        {
                            s32 = templates.generaRef(s32, "dic_estado", s5);
                            s32 = s10 + s32;
                            s35 = templates.ligaImagenTarget(s21, s32, "", "Modificar");
                        }
                        if(s.indexOf("B") >= 0)
                        {
                            s32 = (String)vector2.elementAt(l1 - 1);
                            s32 = templates.generaRef(s32, "dic_estado", s6);
                            s32 = s10 + s32;
                            s35 = s35 + templates.ligaImagenTarget(s22, s32, "", "Borrar");
                        }
                        if(s.indexOf("C") >= 0 && s3.equals("82"))
                        {
                            s32 = (String)vector2.elementAt(l1 - 1);
                            s32 = templates.generaRef(s32, "dic_estado", s7);
                            s32 = s10 + s32;
                            s35 = s35 + templates.ligaImagenTarget(s23, s32, "", "Consultar");
                        }
                        if(s.indexOf("C") >= 0 && s3.equals("112"))
                        {
                            s32 = (String)vector2.elementAt(l1 - 1);
                            s32 = templates.generaRef(s32, "dic_estado", s7);
                            s32 = s10 + s32;
                            s35 = s35 + templates.ligaImagenTarget(s23, s32, "", "Consultar");
                        }
                        int l3 = 0;
                        if(vector5 != null)
                        {
                            Vector vector6 = (Vector)vector5.elementAt(k2);
                            if(vector6.size() > 0)
                            {
                                for(int j4 = 0; j4 < vector6.size(); j4++)
                                {
                                    l3 += 18;
                                    String s40 = (String)vector6.elementAt(j4);
                                    s35 = s35 + s40;
                                }

                            }
                        }
                        k2++;
                        int i4 = 52;
                        i4 += l3;
                        s12 = s12 + templates.tablaColPorcent(s35, String.valueOf(i4), s31);
                    } else
                    {
                        s35 = "";
                        if(dbrecord1.getField(j3) != null)
                            s35 = dbrecord1.getField(j3);
                        if(s35.trim().length() == 0)
                            s35 = "&nbsp;";
                        if(s35.length() > l)
                            s35 = s35.substring(0, l) + " ...";
                        s12 = s12 + templates.tablaCol(s35, s20, s18, s19, s31);
                    }
                } else
                {
                    if(j3 == 0)
                        s35 = "<img src=\"" + s26 + "\" border=0>";
                    s12 = s12 + templates.tablaColNormal(s35, s31);
                }
            }

            s12 = s12 + "</tr>";
        }

        s11 = templates.tabla("0", s12, "100%");
        String s29 = "<img src=\"" + s28 + "/media/btu_ad.gif\" border=0>";
        String s30 = "<img src=\"" + s28 + "/media/btu_at.gif\" border=0>";
        boolean flag1 = false;
        if(j >= 1)
        {
            s30 = "<img src=\"" + s28 + "/media/bto_at.gif\" border=0>";
            j -= k;
            String s33 = url_clases + "/scm/servlet/ConectAc?dic_estado=" + s3 + "&dic_tabla=" + s1 + "&orden=" + s2 + "&rp_count=" + String.valueOf(j) + s9;
            s30 = "<a href=\"" + s33 + "\">" + s30 + "</a>";
            flag1 = true;
        }
        if(j1 < vector1.size())
        {
            s29 = "<img src=\"" + s28 + "/media/bto_ad.gif\" border=0>";
            j = j1;
            String s34 = url_clases + "/scm/servlet/ConectAc?dic_estado=" + s3 + "&dic_tabla=" + s1 + "&orden=" + s2 + "&rp_count=" + String.valueOf(j) + s9;
            s29 = "<a href=\"" + s34 + "\">" + s29 + "</a>";
            flag1 = true;
        }
        if(!flag1)
            s30 = s29 = "";
        int i3 = k + i1;
        if(i3 > vector1.size())
            i3 = vector1.size();
        int k3 = i1 + 1;
        if(vector1.size() == 0)
            k3 = 0;
        String s36 = "Presentando: &nbsp;<b>" + String.valueOf(k3) + "</b>-<b>" + String.valueOf(i3) + "</b>&nbsp; de &nbsp; <b>" + vector1.size() + "</b> &nbsp; registros.";
        s36 = templates.textoFormato(s36, s18, "1");
        String s37 = "";
        s37 = "<tr><td align=\"left\" >" + s36 + "</td> <td align=\"right\" valign=\"top\">" + s30 + "</td>";
        s37 = s37 + "<td align=\"right\" width=\"10%\" valign=\"top\">" + s29 + "</td> </tr>";
        s37 = templates.tablaAlineada("0", s37, "100%", "right");
        s11 = s37 + "<br>" + s11;
        String s38 = templates.textoFormato("<<", s18, "1");
        String s39 = templates.textoFormato(">>", s18, "1");
        String s41 = "";
        if(k < vector1.size())
        {
            int k4 = 0;
            int l4 = 8 * k;
            int i5 = 0;
            if(i1 / l4 > 0)
            {
                int j5 = i1;
                if(j5 % l4 != 0)
                    for(; j5 % l4 != 0; j5 -= k);
                i5 = j5 / l4;
                i5 = l4 * i5;
                k4 = j5;
                String s45 = url_clases + "/scm/servlet/ConectAc?dic_estado=" + s3 + "&dic_tabla=" + s1 + "&orden=" + s2 + "&rp_count=" + String.valueOf(k4 - k) + s9;
                String s47 = templates.textoFormato("<<", s18, "1");
                s38 = " <a href=\"" + s45 + "\" >" + s47 + "</a>";
            }
            s41 = s41 + s38 + "&nbsp; ";
            l4 += i5;
            if(l4 > vector1.size())
                l4 = vector1.size();
            for(; k4 < l4; k4 += k)
            {
                String s42 = url_clases + "/scm/servlet/ConectAc?dic_estado=" + s3 + "&dic_tabla=" + s1 + "&orden=" + s2 + "&rp_count=" + String.valueOf(k4) + s9;
                int k5 = k + k4;
                if(k5 > vector1.size())
                    k5 = vector1.size();
                String s48 = "<b>" + String.valueOf(k4 + 1) + "-" + String.valueOf(k5) + "</b>";
                String s49 = templates.textoFormato(s48, s18, "1");
                if(i1 != k4)
                    s41 = s41 + " <a href=\"" + s42 + "\" >" + s49 + "</a>";
                else
                    s41 = s41 + s49;
                s41 = s41 + "&nbsp; ";
            }

            if(k4 < vector1.size())
            {
                String s43 = url_clases + "/scm/servlet/ConectAc?dic_estado=" + s3 + "&dic_tabla=" + s1 + "&orden=" + s2 + "&rp_count=" + String.valueOf(k4) + s9;
                String s46 = templates.textoFormato(">>", s18, "1");
                s39 = " <a href=\"" + s43 + "\" >" + s46 + "</a>";
            }
            s41 = s41 + s39;
            String s44 = templates.textoFormato("Registros ", s18, "1");
            s41 = "<br><b>" + s44 + "</b> :&nbsp;&nbsp;" + s41;
        }
        s11 = s11 + s41;
        return s11;
    }

    private String generaTablaReporteEspecial(Vector vector, Vector vector1, Vector vector2, int i, boolean flag, int j, String s, 
            String s1, int k, Vector vector3, Vector vector4, HttpServletRequest httpservletrequest, String s2, String s3)
        throws IOException
    {
        String s4 = "";
        String s5 = "";
        String s6 = props.getProperty("titColorRen");
        String s7 = props.getProperty("titFont");
        String s8 = props.getProperty("titTamFont");
        String s9 = props.getProperty("titColorFont");
        String s10 = props.getProperty("datColorRen");
        String s11 = props.getProperty("datFont");
        String s12 = props.getProperty("datTamFont");
        String s13 = props.getProperty("datColorFont");
        String s14 = props.getProperty("imgModificar");
        String s15 = props.getProperty("imgBorrar");
        String s16 = props.getProperty("selColorRen");
        String s17 = props.getProperty("imgDetVacio");
        String s18 = props.getProperty("dir_pagInicio");
        int l = j + k;
        if(l > vector1.size())
            l = vector1.size();
        s5 = s5 + "<tr>";
        for(int i1 = -1; i1 < vector.size(); i1++)
            if(i1 < 0)
                s5 = s5 + templates.tablaCol("&nbsp;", s9, s7, s8, s6);
            else
                s5 = s5 + templates.tablaCol((String)vector.elementAt(i1), s9, s7, s8, s6);

        s5 = s5 + "</tr>";
        int j1 = 0;
        int k1 = l - j;
        k1 = k - k1;
        if(l < k)
            k1 = 0;
        for(int l1 = j; l1 < l + k1; l1++)
        {
            dbRecord dbrecord = null;
            dbRecord dbrecord1 = null;
            String s21 = "FFFFFF";
            String s22 = "";
            if(l1 % 2 != 0)
                s21 = s10;
            if(l1 < l)
            {
                if(vector4 != null)
                    dbrecord = (dbRecord)vector4.elementAt(l1);
                if(FuncEng.coincideRegistro(vector3, httpservletrequest, dbrecord, i) && utilerias.tomaParametro("avance", httpservletrequest) == null)
                    s21 = s16;
                else
                    s5 = s5 + "<tr>";
                dbrecord1 = (dbRecord)vector1.elementAt(l1);
                s22 = (String)vector2.elementAt(j1);
            } else
            {
                s5 = s5 + "<tr>";
            }
            j1++;
            for(int i2 = 0; i2 <= i; i2++)
            {
                String s26 = "";
                if(l1 < l)
                {
                    if(i2 == 0)
                    {
                        s22 = templates.generaRef(s22, "dic_estado", "3");
                        s22 = url_ConectAc + s22;
                        s26 = templates.ligaImagenTarget(s14, s22, "", "Modificar");
                        s22 = (String)vector2.elementAt(j1 - 1);
                        s22 = templates.generaRef(s22, "dic_estado", "2");
                        s22 = url_ConectAc + s22;
                        s26 = s26 + templates.ligaImagenTarget(s15, s22, "", "Borrar");
                        s5 = s5 + templates.tablaColPorcent(s26, "35", s21);
                    } else
                    {
                        s26 = "";
                        if(dbrecord1.getField(i2) != null)
                            s26 = dbrecord1.getField(i2);
                        if(s26.trim().length() == 0)
                            s26 = "&nbsp;";
                        s5 = s5 + templates.tablaCol(s26, s13, s11, s12, s21);
                    }
                } else
                {
                    if(i2 == 0)
                        s26 = "<img src=\"" + s17 + "\" border=0>";
                    s5 = s5 + templates.tablaColNormal(s26, s21);
                }
            }

            s5 = s5 + "</tr>";
        }

        s4 = templates.tabla("0", s5, "100%");
        String s19 = "<form><img src=\"" + s18 + "/media/btu_ad.gif\" border=0></form>";
        String s20 = "<form><img src=\"" + s18 + "/media/btu_at.gif\" border=0></form>";
        boolean flag1 = false;
        if(j >= 1)
        {
            j -= k;
            String s23 = templates.generaHidden("dic_estado", s2);
            s23 = s23 + templates.generaHidden("dic_tabla", s);
            s23 = s23 + templates.generaHidden("orden", s1);
            s23 = s23 + templates.generaHidden("avance", "s");
            s23 = s23 + templates.generaHidden("rp_count", String.valueOf(j));
            s23 = s23 + s3;
            s20 = templates.generaFormaBImagen("", url_ConectAc, "/media/bto_at.gif", s23);
            flag1 = true;
        }
        if(l < vector1.size())
        {
            j = l;
            String s24 = templates.generaHidden("dic_estado", s2);
            s24 = s24 + templates.generaHidden("dic_tabla", s);
            s24 = s24 + templates.generaHidden("orden", s1);
            s24 = s24 + templates.generaHidden("avance", "s");
            s24 = s24 + templates.generaHidden("rp_count", String.valueOf(j));
            s24 = s24 + s3;
            s19 = templates.generaFormaBImagen("", url_ConectAc, "/media/bto_ad.gif", s24);
            flag1 = true;
        }
        if(!flag1)
            s20 = s19 = "";
        String s25 = "";
        s25 = "<tr> <td align=\"right\" valign=\"top\">" + s20 + "</td>";
        s25 = s25 + "<td align=\"right\" width=\"10%\" valign=\"top\">" + s19 + "</td> </tr>";
        s25 = templates.tablaAlineada("0", s25, "50%", "right");
        s4 = s25 + "<br>" + s4;
        return s4;
    }

    private String sqlDetalle(String s, HttpServletRequest httpservletrequest)
        throws IOException
    {
        String s1 = "";
        Vector vector = utilerias.obtieneTabla(s, httpservletrequest);
        if(vector.size() == 0)
            return "";
        dbRecord dbrecord = (dbRecord)vector.elementAt(0);
        if(dbrecord.getField(8) != null)
            return dbrecord.getField(8).trim();
        else
            return s1;
    }

    private boolean validaPks(Vector vector, HttpServletRequest httpservletrequest)
        throws IOException
    {
        for(int i = 0; i < vector.size(); i++)
        {
            String as[] = (String[])vector.elementAt(i);
            String s = "";
            if(as[14].startsWith("s") && as[3] != null && as[3].startsWith("pk"))
            {
                if(utilerias.tomaParametro(as[2], httpservletrequest) == null)
                    return false;
                if(utilerias.tomaParametro(as[2], httpservletrequest).trim().length() == 0)
                    return false;
            }
        }

        return true;
    }

    Properties props;
    String dir_pagInicio;
    String url_ConectAc;
    String url_clases;
}